Skip to main content

Internationalization (i18n)

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.

Previewing translations

Translators can preview translations from Transifex in instances of Streetmix where the TRANSIFEX_API_TOKEN environment variable is defined. When present, the strings for each language code are retrieved directly via the Transifex API. In this way, a translator can try different version of a translation in real time to see how it appears in Streetmix.

If you are an in instance where you do not want live translations from Transifex, unset the TRANSIFEX_API_TOKEN environment variable.

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:

node ./packages/i18n/download_translations.js
info

A valid 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.