Next: Architecture, Previous: Designing levels, Up: Hacker's guide

### 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 `%d`s and `%s`s 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.

- `src/scriptpo.c` : the most important file. It contains the definitions used by all the Guile code, this is where you'll find all the menu labels.
- `src/lib/sys/sys-log.c` : log messages and keywords.
- `src/lib/sys/sys-mem.c` : memory error messages, probably the most important ones.
- `src/lib/lw6-print.c` : contains some messages printed on the console.

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.