Next: , Previous: , Up: Hacker's guide   [Contents][Index]

3.2 Translating

3.2.1 Using gettext

Liquid War 6 uses GNU gettext for all its messages. There’s an online manual about this tool. In practice, what you have to do as a translator is to edit the po/xx.po file with xx being your language / country code. For instance, to translate the game in French, one needs to edit po/fr.po.

3.2.2 Formatted strings

This is very important, you might already be aware of it if you are familiar with gettext, but still it’s worth mentionning : when a string contains special characters such as %d or %s (in a general manner, anything with a % it’s important that all translations contain exactly the same number of %ds and %ss than the original.

For instance:

"foo has %d bars (%s)"

can be translated to:

"ziblug zdonc %d zuc - %s - tac"

The number, order and type of % entries is preserved. To learn more about these formats, use info printf or man 3 printf. In a general manner, get informations about printf.

Additionnally, some strings are used by Scheme (Guile) code and not by C code. Thus, they don’t use the standard C/printf convention. In these strings, what you must preserve and be aware of is the tilde character ~. Very often you’ll see ~a in a string. As with the printf %, you must preserve the number, order and type of those. There is a complete online reference about this way of formatting strings.

3.2.3 Partial translation

Liquid War 6 has thousands and thousands of messages which could theorically be translated. In practise it’s counter-productive to spend time to translate those, as the game is still evolving constantly, and as most of these messages are technical messages which inform about rare bugs and strange conditions. All sort of informations which, while valuable, are not intented for end-users and are more destinated to be reported in bug reports. To select only the interesting messages to translate, the current gettext configuration only uses a reduced set of files.

As a side note, the file src/lib/hlp/hlp-reference.c contains all the entries for the various configuration options, anything that can be queried by liquidwar6 --about=<keyword>. This is several hundred messages. It might be interesting to translate them some day, but it’s obviously not a priority today.

Next: , Previous: , Up: Hacker's guide   [Contents][Index]