2010-03-16

pylons, internationalization

  1. create a i18n-directory into your pylons-project directory on the same level like the config- and the controller-module

  2. install babel

    easy_install babel

  3. scan your app for placeholders with babel

    python setup.py extract_messages

  4. create a new language catalog for the language of your choice with babel

python setup.py init_catalog -l de

  1. compile after every change the language file with babel

    python setup.py compile_catalog

after that, you need to import some methods from the pylons.i18n module:

from pylons.i18n import get\_lang, set\_lang

from pylons.i18n.translation import \_

most of this infos can be found in the official pylon documentation. but some, like the import of _ or the the place of the i18n-directory not.

more:

http://pylonsbook.com/en/1.1/internationalization-and-localization.html

http://wiki.pylonshq.com/display/pylonsdocs/Internationalization+and+Localization

Home Writing Rides Travel Photos Journal