Translation of BKChem is done using Gettext system.

Overview

Translatable strings in sources are marked and then extracted using xgettext into the BKChem.pot file. This file contains only the strings to be translated. Use it for new translations, it is available here.

This file is used to update existing translations – new strings are added, changed strings are marked as fuzzy and deleted strings are marked as obsolete and commented out from *.po file.

This *.po file is compiled to *.mo file which is actually used in running program.

Translators usually have to work only with the BKChem.po file. Translate new strings, check fuzzy translations and send the file to the project maintainer who will take care of the rest.

Tools

You can use any *.po file editor you feel comfortable with. There are some examples:

Files

For existing translations get the *.po file from the source repository.

For new translations it is preferable to start from the BKChem.pot file which you can get at the same place. Just rename it to BKChem.po and proceed as for existing translations.

Plural forms

Gettext uses two main types of functions – for single string and for strings with plural forms. Plural form definition goes in the header of respective language *.po file. It states how many plural forms are in the language (nplurals) and the formula to calculate which form to use for a given number (plural). It might be that the *.po file editor sets this for you when you specify the language for the translation, otherwise you can look up the correct form at http://translate.sourceforge.net/wiki/l10n/pluralforms.

Checking translation in the program

You can also test your translation on your computer before it is included in any release. For that you need to compile the *.po file using your editor if it has such a function or using this command:
$ msgfmt BKChem.po -o BKChem.mo

And then replace old *.mo file with the new one in your installation of BKChem or better extract BKChem tar ball in separate folder and test it there (BKChem.mo file should go in locale/LANG/LC_MESSAGES/ where LANG is your language code).


Updating translations from sources

This is only for reference, users should not do it.

$ cd locale/pot
$ xgettext -L Python --from-code="UTF-8" -w 79 ../../bkchem/*.py ../../bkchem/plugins/*.py -o BKChem.pot

Update the header of BKChem.pot if needed and for each localization do:
$ msgmerge -v --update ../??/BKChem.po BKChem.pot