admi18n :: intro

# Toolbox » Admi18n

Introduction Collect your strings Manage your languages | ### Welcome to admi18n To internationalize your application, you have to: #### Prepare your strings Mark text strings in your code using the _() function, like this
            greetings = _('hello world')
You don't need to do this for text inside tags in your kid template files. Tagged text will be automatically collected:
            <strong>hello world</strong>
Text inside tag properties still needs to be wrapped in a function:
            <img src="$${_('uk_flag.gif')}" />
Date or number strings should be formatted using the turbogears.i18n formatting functions. #### Collect your strings Select which files from within your project you wish to collect strings from. By default al 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 languages Choose 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 catalog Compile your message files to a machine efficient .mo file #### Keep your catalog up to date If 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
            i18n.run_template_filter = True
You let your users change the locale of a running application by updating their session:
            turbogears.i18n.set_session_locale(lang)
Of course the sessions filter should be active for this to work.
            session_filter.on = True
#### See also tg-admin i18n command provides mostly the same functionality as admi18n only via command-line interface.