Now, say you want to offer a multilingual user interface, and you choose to use itools to do the job (a wise decission).
The details on software internationalization and localization with itools are explained on the library documentation available from the itools web site, see in particular the chapter about the itools.gettext package.
Here we are going to explain the aspects related to packaging.
The first thing to do is to define the source and target languages in the configuration file:
setup.conf:
# Languages
source_language = en
target_languages = es fr
In this example the source language is English, and there are two target languages, Spanish and French.
Running the isetup-update-locale.py at this point will automatically create the locale folder, the POT template, and a PO file for each language:
$ isetup-update-locale.py
* Extract text strings from Python files..
* Update PO template
* Update PO files:
en.po (new)
es.po (new)
fr.po (new)
$ tree locale
locale
|-- en.po
|-- es.po
|-- fr.po
`-- locale.pot
Since the PO files belong to the source, we should add them to the Git archive every time we run the isetup-update-locale.py script:
$ git add locale/locale.pot locale/*.po
$ git commit -m "Update PO files."
Created commit d79de97: Update PO files.
...
At this point we must come back to the isetup-build.py script. If we run it again, once the package has been internationalized, we will find out it does a little more than before:
$ isetup-build.py
* Version: master-200712101700
* Compile message catalogs: en es fr
* Build MANIFEST file (list of files to install)
$ tree locale
locale
|-- en.mo
|-- en.po
|-- es.mo
|-- es.po
|-- fr.mo
|-- fr.po
`-- locale.pot
The isetup-build.py script has compiled the PO files to produce one binary MO file per language. These binary files will be used at run time by the internationalization logic to expose a multilingual interface to the user.