Where translations live¶
The locale files are located in the
assets/locales folder, and each separated into sub-directories named by their locale code. These files are generated by an automated script. Do not manually edit locale files!
Adding or modifying translatable strings¶
There is one exception to the above rule, and that’s the files in the
assets/locales/en folder. The English (US) translations are the source language for all translatable strings in Streetmix. This file can be manually modified as necessary to add, edit, or remote translatable strings from the application. Changes here will be automatically mirrored in Transifex within one day.
When new strings are added, Transifex will make them available to be translated in all other languages.
When strings are modified, Transifex will reset all languages to be the blank string, but will remember the history of previous strings.
When strings are deleted, Transifex deletes that string from all locales, including its history. Deleting strings are extremely destructive and cannot be recovered. Therefore, be very careful when deleting strings. The danger of losing history usually means that even when a feature has been deprecated or removed, the translation strings will not be removed, out of an abundance of caution.
In development and other testing environments, the strings for each language code are retrieved directly from the Transifex platform via its API. This means a translator can attempt different translations in real time and preview how it appears in Streetmix.
To change this behavior, set the l10n.use_local configuration property in the desired environment in the
Updating locale files¶
Periodically, we export a snapshot of the translated strings from Transifex and store them in our git repository. These locale files are used in production (and offline) deployments, which requires a more stable source of translation.
You can update locale files by running this on the command line:
TRANSIFEX_API_TOKEN must be set in environment variables in order to retrieve translations. This environment variable can be obtained from the Transifex platform and it must correspond to a user who is a member of the Streetmix team.