![]() | Developer's Guide to KHangMan |
Prev | Next |
Thanks to Stefan Asserhäll, it is very easy to add a new language directly to the game. The procedure described here can also be found in the khangman source folder in the file README.languages. Please follow the procedure and then send me the files tarred and gzipped to annemarie.mahfouf@free.fr.
Download the latest cvs version of KHangMan. The words are stored in 4 separate files, one for each level. The files are in /khangman/data/language_code. The file easy.txt is for level easy, the file medium.txt is for level medium, the file animals.txt is for level animals and the file hard.txt is for level hard.
Procedure 5.1.
Enter the following commands in a Konsole to create the folder and files for the new language:
./add_language language_code
Here you must replace language_code with your language code.
Edit all indicated text files in the new folder with a text editor, and replace each word with a translated word. 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 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.
Remember that all words are nouns.
Note that you must use UTF-8 encoding when editing the files. If your editor cannot do this, try using KWrite or Kate. When opening a file in KWrite or Kate you can select utf8 encoding with the combo box at the top of the file open dialog.
Please keep the actual English filenames in your language_code dir.
Enter the following command to install the new data files:
make make install
You may have to become root to run make install, depending on your installation.
Run the game and check that your language has been added:
khangman
Then tar the files and send them so I can add them to the Get New Stuff server and also in the corresponding kde-i18n module in cvs.
If you want to have hints in the new language, then you will have more work to do. You will have to use the kvtml format and the best thing to do is to have a look at the French or Italian data. The tag <o> is for the word and <t> for the hint. 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 SYSTEM "kvoctrain.dtd"> <kvtml> <e> <o>cane</o> <t>è il tuo animale domestico preferito</t> </e> ... ... </kvtml>
Prev | Home | Next |
Command Reference | Up | What is stored by KHangMan and where |