344 | | * identify any strings that have not been properly localised. |
345 | | * Concatenation of localized strings - use %(variable_name)s instead |
| 344 | * Identify any strings that have not been properly marked to be localised: |
| 345 | * Strings that users will see need to be localized -- these are strings that appear in the user interface, such as in menus and forms and help info. |
| 346 | * Not all strings need to be localized, and some definitely should not be. |
| 347 | * Strings that are used as keys in dicts, e.g. `{"this_is_a_key": 5}`, should not be localized. |
| 348 | * A string that is intended to be in one specific language should not be localized. |
| 349 | * Strings that need to be localized should have `T( )` around them. |
| 350 | * Avoid concatenation of localized strings with variables - use %s or %(key)s instead. That is, instead of:[[br]] |
| 351 | {{{T("My name is ") + name}}}[[br]] |
| 352 | use this:[[br]] |
| 353 | {{{T("My name is %s") % name}}}[[br]] |
| 354 | And instead of:[[br]] |
| 355 | {{{T("The item ") + item + T(" is not available in ") + location.name}}}[[br]] |
| 356 | use this:[[br]] |
| 357 | {{{T("The item %(item)s is not available in %(place)s.") % {"item": item, "place": location.name}}}}[[br]] |
| 358 | 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. |