Internationalize a Python application
ifrade (Talk | contribs)
(New page: Category:Internationalization Category:Developers Category:N900 = Internationalization of a python application (in Maemo) = This page explains step by step add support for tr...)
Newer edit →
(New page: Category:Internationalization Category:Developers Category:N900 = Internationalization of a python application (in Maemo) = This page explains step by step add support for tr...)
Newer edit →
Revision as of 12:28, 23 April 2010
Contents |
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:
- Define correctly a function '_()' that translates strings
- Mark the strings in the code with that function
- Generate a template for the translators
- Add translations
- 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 the _() function! import i18n _ = i18n.language.gettext class Example (hildon.StackableWindow): def __init__ (self): hildon.StackableWindow.__init__ (self) self.set_title (_("All music"))
Generate template for the translators
TODO
Include translations in your installation
TODO
How to add translations
TODO