GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||
GeezerVison is showing docs.python.org — 6.23.3 Internationalizing your programs and modules
6.23.3 Internationalizing your programs and modulesInternationalization (I18N) refers to the operation by which a program is made aware of multiple languages. Localization (L10N) refers to the adaptation of your program, once internationalized, to the local language and cultural habits. In order to provide multilingual messages for your Python programs, you need to take the following steps:
In order to prepare your code for I18N, you need to look at all the
strings in your files. Any string that needs to be translated
should be marked by wrapping it in
In this example, the string
The GNU For I18N Python programs however, xgettext won't work; it doesn't understand the myriad of string types support by Python. The standard Python distribution provides a tool called pygettext that does though (found in the Tools/i18n/ directory).6.3 This is a command line script that supports a similar interface as xgettext; see its documentation for details. Once you've used pygettext to create your .pot files, you can use the standard GNU gettext tools to generate your machine-readable .mo files, which are readable by the GNUTranslations class. How you use the gettext module in your code depends on whether you are internationalizing your entire application or a single module.
Footnotes
Subsections
See About this document... for information on suggesting changes. | ||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |