Sahana Eden

Localization

By default Sahana Eden displays all information in US English. However, the system is fully internationalized, which means that all text elements of the user interface can be displayed in any language, including right-to-left languages.

The process of "localizing" Sahana Eden (adapting it to specific language and locale) involves translating the text elements of the user interface into whatever language is needed.

Many translations are already available for Sahana Eden, although they may not be complete or not up-to-date. These include:

  • Arabic
  • Bosnian
  • Chinese (Simplified)
  • Chinese (Traditional)
  • Dari
  • English (UK)
  • French
  • German
  • Italian
  • Japanese
  • Khmer
  • Korean
  • Nepali
  • Pashto
  • Portuguese (Brazil)
  • Portuguese (Portugal)
  • Spanish
  • Russian
  • Tagalog
  • Tetum
  • Vietnamese

Updating an Existing Translation

If you need to update an existing translation, either because it is incomplete or to add customized strings specific to your installation, then you need to update a text file in the languages folder (e.g. languages/de.py for the German translation). This file contains a Python dictionary to map the original US English strings to their translated counterparts.

There are 2 approaches that you can take to generate an empty language file for translation:

  1. If you have just a small number of modules that you wish to translate quickly then you can remove all untranslated strings from an existing language file. Then navigate through these modules - this will add any untranslated strings that the system encounters to the language file (assuming the relevant file permissions allow this).
  2. If you wish to translate the entire application as part of a Preparedness project then you can update all the language files in languages by doing the following:
cd web2py
python web2py.py -S eden -R applications/eden/static/scripts/tools/languages.py

There are 3 approaches you can take to do the translations:

Note: Inform all translators to not translate the variables within strings (e.g. %(name)s), but just move around the surrounding text to ensure that the word order makes sense.

  1. If you have a small number of strings to translate then it is possible to do this using the Web2Py Admin Interface (this assumes that you have a local branch on your machine to work on):
  2. http://127.0.0.1:8000/admin/default/design/eden#languages

  3. If you want to send these strings to be translated by a professional translation company, then they will typically expect the strings in spreadsheet format. You can create a CSV of strings using the Translate Toolkit:
  4. web2py2po -i language.py -o language.po
    po2csv -i language.po -o language.csv
    

    Tip: Excel has a nasty habit of corrupting strings with quotation marks or other special characters, so avoid this if possible & be prepared to clean-up if not.

  5. If you want to use a community of translators then you can use Pootle (see below).

Adding a New Translation

This can be done via the Web2Py admin interface:

http://127.0.0.1:8000/admin/default/design/eden#languages

Create a new file using the ISO 639-1 Code of the Language plus ".py" as the filename. If it is a national variation of a language, eg. New Zealand English, add a suffix to the language code: "en_nz.py".

The same process then applies as for updating an existing language.

Using Pootle to Manage Translations

Pootle is a web-based tool to manage translations by a group of translators which includes the ability to have alternate suggestions reviewed before being selected.

There is a Sahana instance at http://pootle.sahanafoundation.org  which is available for you to manage the translation for your language.

To use Pootle you need to convert the .py version of your translation to/from the PO format, which can be done using web2py2po from the Translate Toolkit.