Version 10 (modified by Fran Boon, 15 years ago) ( diff )

All references to time should use request.utcnow rather than


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 --timeout=120 ...

All Labels should be explicitly Internationalised:

db.table.field.label = T('Field')

To make dropdown options localisable, use this pattern:

module_field_type_opts = {
opt_module_field_type = SQLTable(None, 'opt_module_field_type',
                    db.Field('field_type', 'integer', notnull=True,
                    requires = IS_IN_SET(module_field_type_opts),
                    default = 1,
                    represent = lambda opt: opt and module_field_type_opts[opt]))


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


All references to time should use request.utcnow rather than

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:
    • german translation:
  • insert [[TranslatedPages]] macro to display a list of available translations of a page (at best at bottom of page)



Note: See TracWiki for help on using the wiki.