Internationalize a Python application

= Internationalization of a python application (in Maemo) =

This page explains step by step add support for translations in a python application for maemo.

There are already some tutorials online about how to internationalize (i18n) python applications, but i find them confusing and they lack some needed code and final tricks to make everything work fine. This is the steps i followed to add i18n in my project Mussorgsky.

To support i18n we need to accomplish 5 tasks:
 * 1) Define correctly a function '_' that translates strings
 * 2) Mark the strings in the code with that function
 * 3) Generate a template for the translators
 * 4) Add translations
 * 5) Include the translations in your installation

The overall process (What gettext is)
TODO

Configure gettext Define the '_' function
TODO

Mark strings for i18n
This is one of the easiest parts. Browse the source code files that show something on the string, and wrap the visible strings (window titles, dialog titles, notifications, labels, button labels and so on) with the '_' function.

For example:

import i18n _ = i18n.language.gettext class Example (hildon.StackableWindow): def __init__ (self): hildon.StackableWindow.__init__ (self) self.set_title (_("All music"))
 * 1) import the _ function!

Generate template for the translators
TODO

Include translations in your installation
TODO

How to add translations
TODO