Internationalization

dopewars uses the GNU gettext utilities for internationalization (i18n) support. This allows the software to be translated into the local language at runtime - run dopewars in the UK and it'll talk to you in English, but run it in Germany and it'll talk to you in German. This relies on translators to translate the program's output into each language beforehand, of course, and so native language speakers to carry out this task are always needed!

Running dopewars with i18n support

i18n is only included in versions of dopewars later than 1.4.8. By default, "Native Language Support" is compiled in; binary installations should be already set up for i18n. When compiling dopewars from source code, the configure script should detect whether your system can support GNU gettext. To disable i18n, pass the --disable-nls option to the configure script.

When you run your installed copy of dopewars, it should detect your "locale" automatically and talk to you in your native language. If this does not happen, the following are some possible explanations:-

Adding a new translation

Translation files are kept in the subdirectory po/ of the dopewars source code distribution. They are named by 2-letter language codes followed by the .po extension - for example, the German translation is stored in the file po/de.po. They are simple text files, consisting of lists of the original English string (labelled by "msgid") followed by the translated string (labelled by "msgstr").

To add a new translation, first install dopewars from source code. This will generate the reference file dopewars.pot in the po subdirectory. Then, copy dopewars.pot to your language-specific .po file in the po/ directory, and fill in the "msgstr" entries. Once this is done, edit the configure.ac file in the top dopewars directory to add your language code to the ALL_LINGUAS variable. Then run autoconf to rebuild the configure script, before making and installing dopewars as usual. The new translation should now be available. Once this is complete, please open a pull request to have the translation included in the next dopewars version.

Please note that some strings are format strings containing the % character. These are used in the program code for substituting numbers and other pieces of text into the string - these substitutions are are performed using variables which are specified in the same order as the % characters in the format string. For example, the following format string substitutes in a string (%s) and an integer number (%d):-
"String '%s' has %d characters"
The string and number are specified in order in the code. This is problematic if your translation changes the order - for example, a valid German translation of the string would be
"%d Zeichen lang ist die Zeichenkette '%s'"
Now the number and string are specified in the wrong order, and this will probably crash the program on running! To fix this, use the special notation
"%2$d Zeichen lang ist die Zeichenkette '%1$s'"
(i.e. replace %x with %n$x where n is the index that the format specifier "should" have, starting from 1.)

dopewars specifics

Updating a translation for a new dopewars version

New versions of dopewars will often change what is printed to the user, and so may may require changes to the translation. To update an existing translation, change into the po subdirectory of the dopewars source code, and do a "make dopewars.pot". This creates the dopewars.pot file, which lists the strings that need translating. Next, create a new translation file from your "old" translation file (we'll assume it's called de.po) and dopewars.pot with the msgmerge command:-
msgmerge -o newfile de.po dopewars.pot
Examine this new file newfile for translations that need updating (a search for "fuzzy" should find most of them) and then overwrite your old translation with the new one:
mv newfile de.po
Rebuild and reinstall dopewars, and the new translations should become available. Again, it is deeply appreciated if such updated files are contributed to the main dopewars distribution!

Currently available translations


Last update: 25-06-2022
Valid XHTML 1.1