Locales
Last updated
Last updated
EJS uses the concept of locales to represent a language and region combination. This allows for nuanced support for multiple dialects of a common language (such as American English vs Canadian English).
Each locale is represented by a locale code: a lowercase language code and an uppercase country code, separated by a hyphen (e.g. en-US for American English).
The following locales are currently supported. You may define other locales in your , but the application will not be able to load them at this time.
en-US: English - United States
en-CA: English - Canada
fr-CA: French - Canada
es-ES: Spanish - Spain
Additional locales will be added in each release.
The active locale determines which are loaded and applied. When the active locale is changed, the associated language pack from the active will be loaded and applied.
An application must also specify a default locale. If an active locale has not been specified, the default locale will become the active locale.
From inside a , you may use the to change the active locale.
When performing a translation, if a is not available for the active locale, the translator will attempt to locate the string for the default locale as a fall-back. If the string isn't found in either the active or default locale, the resource identifier is returned.
If the i18n-warnings
has been enabled, a console warning will be issued for a missing in the active locale, and an error if the string is also missing from the default locale.