# How to translate CRRCSim in a new language

## Selection of the used language

It is the environment system in the launch of CRRCSim that defines the used language. It not thus normally nothing to make.

For a test it is enough (under Linux) to set the variable of environment LANG before the call of crrcsim. He can be also necessary to delete the contents of the variabe LANGUAGE. Attention: the language must be installed on the host system !

`export LANG=fr_FR.utf8; export LANGUAGE= ;crrcsim`

If the dictionary does not exist by for the wanted language or if it is incomplete, it is English which is used

## Library used for translation

GNU `gettext'.(http://www.gnu.org/software/gettext/)

In the source code, every text to translate is so marked :
`str = "string to translate";` ==> `str = _("string to translate");`

"`i18n.h`" is to include in every file containing string to translate.

## Where are dictionaries files?

The directory `locale` contains, for a language `**` (`**` = `fr` for French, `de` for German...), 2 files:

`**/LC_MESSAGES/crrcsim.mo` : The compiled dictionary. It is the one which is used in the execution of CrrcSim

`**/LC_MESSAGES/crrcsim.po` : Source of the dictionary. For update.

## How to update a dictionary

It is advised to use `poedit`.

- Open the file `crrcsim.po`. If need, use the command "update from sources".

- Modify the translation.

- Save result (verify that the option "Compile automatically" is active.)

## How to create a new language

- Duplicate '`locale/xx/`' and its content in '`locale/**/`' (`**` = codes of new language)

- Add the new .po and .mo files to `locale/Makefile.am`

- Open '`locale/**/LC_MESSAGES/crrcsim.po`' with `poedit`

- Edit the information of the cataloque (catalogue parameters)

- Edit the translation as above.

## Limitations

The internal characters coding being made on 8 bit, all the translations are not possible.

### Crrcsim 0.9.12

Only the languages which can be written with the coding ISO-8859-15 (Latin 1, Western European) can be translated.

### Later versions

Most of the languages which can be written with a coding 8 bits and the writing of which is made of left to right must be able to be translated.

For that purpose, it is necessary :

- In the .po file, "translate" `iso8859-15` by appropriate coding. For example `iso8859-2` for the Czech, `iso8859-5` for the Russian. - To install in the directory `textures` the font file corresponding. By example `Sans_iso8859-2.txf` . A utility of transcoding is available in the directory `fonts_utility`