Localizations
Localizations allow to run mobile apps in different languages.
The application language is picked by default from your browser settings. If your browser language is English, you will get the app in English. You will get English locale (date format, numbers format) also.
If you want to change the application language you can:
- change the language in the browser settings
- run the app with lng URL query parameter - look Overview for more details
If you do not have the translation made for given language or it is not complete then the whole app or some literals appear in base language (usually English).
Folder structure
locales is the folder with localizations. It contains subfolder(s) with language JSON file(s) where the name of subfolder and the postfix for language file complies with locale notation e.g. ‘en’ for English, ‘en_US’ for American English, and the name of language file corresponds with translation_xx.json pattern.
To see more about app folder structure look at Configuration
Below there is an example from mwhs_dc1-11 app:
locales folder structure
Content of language file
The language file holds data in JSON format. It contains key/value pairs where:
- key can be:
- predefined constant
- literal (phrase) which appears in base language version of app (usually in English)
- value is literal (phrase) corresponding with key translated to another language
In the example below we can see part of translation_fi.json language file taken from mwhs_dc1-11 app. It contains translations for predefined constants (e.g. app-trademark-title) and literals (e.g. Find) as well.
To edit language file there is no need to have special tool. Any editor where you can handle text file is good (e.g. Notepad), but the tool supporting JSON is recommended.