Reading:
- http://docs.python.org/lib/node738.html
- http://po-utils.progiciels-bpi.ca/showfile.html?name=dist/README
What do I understand?:
The process of i18n (and l8n) involves a couple of steps:
decide a name for the application (e.g. myapp)
‘marking’ string in the source as translated, most of the time using the underscore function
Collecting all the string into a translation template - *.pot (pygettext)
translating the files - basically copy the .pot into a .po file, and then translating
converting the .po into a .mo file (msgfmt.py)
copy the .mo file at the proper location locale/de/LC_MESSAGES/myapp.mo
locale/de/LC_MESSAGES/myapp.mo
locale/london/LC_MESSAGES/myapp.moIn the source, do a:
import gettext lang1 = gettext.translation('myapp', './locale',languages=['de']) lang2 = gettext.translation('myapp', './locale',languages=['london','en']) lang1.install() print _('foobar') lang2.install() print _('foobar')`
That should be it