There are two kind of resources that are localizable.
- Text in UI like: Map, About, Support, etc.
- Some data of facilities: services names.
The application is configured with a list of enabled locales that are displayed to the end user.
The current locale is selected by a query string, cookie, browser accepted languages or default application locale.
Let's supose we want to add a new fr
locale. The following steps should be performed:
- Create a
config/locales/fr.yml
with the translated content fromconfig/locales/en.yml
- Ensure the dataset is enhanced with the
fr
locale. This means that aname:fr
column should be present atdata/input/services.csv
. Check in importing data for more information. - Import the dataset.
- Enable the
fr
locale by changing the settings.yml or theSETTINGS__LOCALES__FR=French
environment variable.
# file: config/settings.yml
# ...
default_locale: en
locales:
en: English
fr: Français
The config/locales/*.yml
are translated to javascript thanks to i18n-js gem. So upon deployment a new version of assets will be generated with this resources.