This page describes the way we have prepared the programs and the distribution to enable translators to provide versions for languages other than English. Once a translation for a particular language is included in the distribution players should be able to use that version instead of the English version. This means that all the text seen by the player would be in their own language.
We are using the Gettext system. The text in our programs includes: built-in help, hint algorithm explanations, menus, tooltips, file opening dialogues and error messages. For the gettext system we wrap all text that the user would see in special code. We then run a program which analyses our program code to search for the wrapped text. For each program it writes the text to a Portable Object Template (.pot) file. This file contains 3 records for each individual text string: the location of the original text, a msgid record containing the original text, a msgstr record ready for the translators input. To create a translation for a game the translator would take a copy of its .pot file and for each msgstr record fill in the translation of the associated msgid record. That file is then copied as a .po file to the language's LC_MESSAGES directory and used as input to another program which creates a binary .mo (Machine Object) file. That .mo file will be used to provide the translation when the corresponding game program is running. For French the directory would be PROGRAMS/locales/fr/LC_MESSAGES; for German PROGRAMS/locales/de/LC_MESSAGES.
Please note that we did all this translation preparation work after being contacted by someone volunteering to provide a French version. But, unfortunately they disappeared without producing the necessary text. So there is only an English version!
#: suguru.py:135 msgid "Save Settings" msgstr "" #: suguru.py:142 msgid "Save Puzzle" msgstr "" #: suguru.py:149 msgid "Load Puzzle" msgstr ""
Part of the .pot file for the suguru menu.
#: suguru.py:135 msgid "Save Settings" msgstr "Enregistrer les réglages" #: suguru.py:142 msgid "Save Puzzle" msgstr "Enregistrer le puzzle" #: suguru.py:149 msgid "Load Puzzle" msgstr "Ouvrir le Puzzle"
Part of the .pot file for suguru after the translations have been added.
Partly as a reminder to ourselves the next section outlines the steps required, using suguru and French as an example.
1. generate pot file pygettext -d suguru -o locales/suguru.pot suguru.py In our hands this does not define Content-Type and Content-Transfer-Encoding in the way needed. So 2. Edit pot file to define: "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" sed -i -e 's/=CHARSET/=UTF-8/' -e 's/ENCODING/8bit/' suguru.pot 3. Copy locales/suguru.pot to a work directory. Edit this copy of suguru.pot file to contain the translations in the msgstr "" records 4. Copy the edited suguru.pot file to the locales/fr/LC_MESSAGES directory $cp suguru.pot locales/fr/LC_MESSAGES/suguru.po Note the change to .po which is the file extension expected by msgfmt. 5. Run msgfmt In LC_MESSAGES directory run: msgfmt -o suguru.mo suguru NB make_pot_files.py performs steps 1 and 2 for all programs.
PROGRAMS *.py locales *.pot fr LC_MESSAGES *.po *.mo de LC_MESSAGES *.po