100 | | === Review code for quality of localized strings === |
101 | | ''Not added to GCI spreadsheet -- this was a task for GCI 2011, so would need to identify what was not done.''[[BR]] |
102 | | All strings which appear in the user interface, such as in menus and forms and help info, should be "internationalized" -- marked to make them available to be translated into different languages. This is done by putting the strings inside of {{{T( )}}}, e.g. {{{T("This string will be written into language files to be translated")}}}. The strings in {{{T( )}}} are keys that are used to look up translated strings. By convention, the key strings are in US English. |
103 | | |
104 | | For GCI, you will need to review all the internationalized strings in the model and controller files for a single module, eg: |
105 | | * {{{controllers\gis.py}}}, {{{models\gis.py}}}, and {{{views/gis/*.html}}} |
106 | | * {{{controllers\hrm.py}}}, {{{models\hrm.py}}}, and {{{views/hrm/*.html}}} |
107 | | * {{{controllers\default.py}}} and {{{views/default/*.html}}} |
108 | | |
109 | | Check for: |
110 | | * Incomplete or cut-off sentences in the translation strings |
111 | | * Avoid concatenation of localized strings with variables - use %s or %(key)s instead. That is, instead of:[[br]] |
112 | | {{{T("My name is ") + name}}}[[br]] |
113 | | use this:[[br]] |
114 | | {{{T("My name is %s") % name}}}[[br]] |
115 | | And instead of:[[br]] |
116 | | {{{T("The item ") + item + T(" is not available in ") + location.name}}}[[br]] |
117 | | use this:[[br]] |
118 | | {{{T("The item %(item)s is not available in %(place)s.") % {"item": item, "place": location.name}}}}[[br]] |
119 | | This is better because the word order is not the same in all languages -- in the second form, the translator can move where the variables are inserted. |
120 | | * Look for fields without a label - e.g. Field("fieldname") as these cannot be localised. |
121 | | * Look at strings that have not been wrapped in {{{T( )}}} to see if they ought to be. But be cautious: Not all strings need to be localized, and some definitely should not be: |
122 | | * Strings that are used as keys in dicts, e.g. `{"this_is_a_key": 5}`, should not be localized. |
123 | | * A string that is intended to be in one specific language should not be localized (e.g. the language names in the language menu in {{{deployment-templates/models/000_config.py}}}). |
124 | | * Consider improving consistency of wording / terminology - don't use different strings that mean the same thing, e.g. if there is {{{T("My name is")}}} in one place, avoid using {{{T("I am called")}}} somewhere else. |
125 | | |
126 | | You will need to download a working branch of Sahana Eden code for this task and push the changes you make to your own branch on Git. |
127 | | |
128 | | Please focus on modules which are [https://github.com/flavour/eden/blob/master/deployment-templates/models/000_config.py#L427 enabled by default]. |
129 | | |