Translations
Apps by default run in English, but many defaut screen elements can be translated into other languages.
This is done by setting translations in a JSON array, where the key is the English text, and the value is the translated text.
For example:
{
"Save": "Speichern",
"Cancel": "Abbrechen"
}
This would change all save and cancel buttons in the UI.
You can also change translations dynamically in any server-side code events that expose the translations
variable.
For example, if you have links that add a URL parameter for lang, you could do something like:
if ( url_parameters.lang == "de" ) {
translations = {"Save":"Speichern","Cancel":"Abbrechen"}
}
if ( url_parameters.lang == "es" ) {
translations = {"Save":"Ahorrar","Cancel":"Cancelar"}
}
To reset translations back to default, simply provide a non-valid object, eg:
if ( url_parameters.lang == "en" ) {
translations = "reset"
}