Skip to content

Localization guide

dgranda edited this page Jul 18, 2012 · 1 revision

Localization guide

pytrainer currently uses GNU gettext to support different languages.

How to add new language?

You need to complete 3 steps:

  1. Infrastructure

    • Add locale in utils/translator.sh script
    • Create appropiate path: locale/<new_locale>/LC_MESSAGES/
    • Create appropiate Makefile for <new_locale>
    • Change setup.py script to let it install new localization file
  2. Creation of pytrainer.mo file through po file

    Good idea is to create an empty file:

    touch locale/<new_locale>/LC_MESSAGES/pytrainer_<new_locale>.po

    and then execute utils/translatior.sh script. It will:

    1. Parse pytrainer and retrieve everything elegible to be translated
    2. Launch gettext catalogs (.po files) editor (poedit, gtranslator) to make translations (user input needed!)
    3. Merge old localization file and new one created through the editor -> pytrainer_<new_locale>.po
    4. Compile po file to obtain locale/<new_locale>/LC_MESSAGES/pytrainer.mo
  3. Make pytrainer aware of new localization.

    Executing setup.py script gets locale from working copy and copies pytrainer.mo to final destination.

At next start of pytrainer <new_locale> will be available

Clone this wiki locally