wiki:DeveloperGuidelines/Internationalisation

Version 3 (modified by Fran Boon, 12 years ago) ( diff )

Full Dropdowns pattern (inc re-accessible lookup & represent)

Internationalisation

The original language of the SahanaPy user interface, source code labels and comments, and the Wiki pages is English (international). No contributions can be accepted without being at least translated to english. If you need help to translate your contents to english, please contact the Sahana Localization team.

However, translation to other languages is highly appreciated - please contact the Localization team for advice.

Web2py localization engine

  • T() function performs dictionary lookups (similar to GNU/gettext _()), see here for example
  • the dictionaries are located in the languages subfolder of the application
  • dictionaries can be translated using the web2py web interface (RAD mode)
    • suggest increasing the timeout from the default 10 minutes: python web2py.py --timeout=120 ...

To make dropdown options localisable, use this pattern:

table_field_opts = {'1':T('Option1'), '2':T('Option2')}
db[table][field].requires = IS_IN_SET(table_field_opts)
db[table][field].represent = lambda opt: table_field_opts[opt]

All reference to the options in View code should be by Index not by string (since the string can be changed).

Pootle/translate toolkit and web2py dictionaries

Wiki pages translation

  • translated pages with ISO 639-2 language code extension (original english page = no extension), e.g.
    • original page: trac.sahanapy.org/wiki/BluePrintInternationalisation
    • german translation: trac.sahanapy.org/wiki/BluePrintInternationalisation/de
  • insert [[TranslatedPages]] macro to display a list of available translations of a page (at best at bottom of page)

BluePrintInternationalisation

DeveloperGuidelines

Note: See TracWiki for help on using the wiki.