Projects/Edu/Khangman: Difference between revisions

    From KDE TechBase
    < Projects‎ | Edu
    No edit summary
    Line 1: Line 1:
    {{Template:I18n/Language Navigation Bar|Projects/KHangMan}}
     


    ==About KHangMan==
    ==About KHangMan==

    Revision as of 16:39, 19 July 2012


    About KHangMan

    Refer to http://userbase.kde.org/KHangMan

    Translate Words in your language

    Here is a an outline of the steps necessary to translate the words of the game to your language. Please note that you can adapt the words as you want as long as you keep words corresponding to the level. KHangMan shares its files with KAnagram so you might also want to have a look at KAnagram website. The words are stored in 4 separate files, one for each level. The files are in /kvtml/data/. The file easy.kvtml is for easy-to-guess words, the file medium.kvtml is for level medium, the file animals.kvtml is for guessing animals names and the file hard.kvtml is for difficult-to-guess words. English is the default and thus the only language to be shipped with KHangMan. All other language data are put in the corresponding l10n-kde4 module. You can download the source with the English files here: khangman-data.tar.gz

    The files use the kvtml format. The tag <text> is for the word and the tag <comment> is for the hint, those are within a <entry> tag. Please try to match the hint with the level of difficulty. The level 'Easy' will require an easy hint but the level 'Hard' will require the definition in the dictionary. Try not to use words of the same family in the hint, that would give the word away too easily!


    An example of a kvtml file is as follow:

    <?xml version="1.0"?> 
    <DOCTYPE kvtml PUBLIC "kvtml2.dtd" "http://edu.kde.org/kanagram/kvtml2.dtd"> 
    <kvtml version="2.0"> 
    <information>
        <generator>converter</generator>
        <title>Animals</title><!--Translate tag content-->
        <comment>Animals from across the planet</comment><!--Translate tag content-->
      </information>
      <identifiers>
        <identifier id="0" >
          <locale>en</locale>
        </identifier>
      </identifiers>
    ...
    <entry id="0" >
          <inactive>false</inactive>
          <inquery>false</inquery>
          <translation id="0" >
            <text>bear</text><!--Translate all text tags content-->
            <comment>Large heavy animal with thick fur</comment><!--Translate all comment tags content-->
          </translation>
        </entry>
    ...
    </kvtml>
     

    At the beginning of the file, you should translate the content of the <title> and <comment> tags which are within the <information> tag. The title will be the one that will appear in the Category menu of the game (where the user chooses the file to play with). Then within the <identifier> tag, please put your language code instead of en in <locale>. Please don't translate the file name itself as filenames should never contain any special charaters. Thus please save your file with the same English filenames.

    Edit the kvtml files with a text editor (it will be easier if you use the XML syntax highlighting) and replace each word inside the <text> tag with a translated word and each hint inside a <comment> with a translated hint. It is not really important that the exact meaning is preserved, but try to keep the length and level of difficulty roughly the same.
    You can include words with white space or - in them, in that case the white space or the - will be shown instead of the _.

    You can just translate the words but you can also adapt them following the level and add new words if you want. For example, "table" is in level easy in English but in your language, it can be level medium. Feel free to adapt the files to your language needs. The number of words in a file is not important, you can add some if you want.

    If you have special characters in your language such the accented letters in French, you can write them in a file named <yourlang>.txt, one character per line and save that as UTF-8. Then you also have to add in the CMakeLists.txt the following:

    install( FILES <yourlang>.txt DESTINATION ${DATA_INSTALL_DIR}/khangman ).

    Note that you must use UTF-8 encoding when editing the files. If your editor can't do this, try using kwrite or kate. When opening a file in kwrite or kate you can select utf8 encoding with the top right combo box.

    You can then commit your files in l10n-kde4/<lang_code>/data/kdeedu/khangman. Don't forget to update the CMakeLists.txt file as well.

    Contact

    Please contact annma if there is anything special related to your language so I can adapt the code to it (especially the special and accented characters).

    Good luck and many thanks!