![]() |
Welcome to admi18nTo internationalize your application, you have to: Prepare your stringsMark text strings in your code using the _() function, like this
You don't need to do this for text inside tags in your Kid template files.
Tagged text will be automatically collected:
Text inside tag properties still needs to be wrapped in a function:
Date or number strings should be formatted using the turbogears.i18n formatting functions.
Collect your stringsSelect which files from within your project you wish to collect strings from. By default all Python and Kid files are selected. The collected string will be saved in a '.pot' file, inside a 'locales' directory whithin your project. Add locales - Manage your languagesChoose a language you want your application localized to. Send your language file to a translator or edit the file directly from within the application. Sort your messages by id, message text or context. Compile your catalogCompile your message files to a machine efficient .mo file Keep your catalog up to dateIf you later add more strings to your source files or Kid templates, collect the strings again and in the language management page, choose your catalogs and run 'Merge collected strings'. This will merge the new strings into your selected catalogs. Once you translate the new strings, recompile your catalog. And finally...If you want your templates to be automatically translated, add the i18n template filter to your configuration file
You let your users change the locale of a running application by updating their session:
Of course the sessions tool should be active for this to work.
See also
The |