Translations (i18n)
Last updated
Was this helpful?
Last updated
Was this helpful?
Default namespace is called common
and contains translations used on all pages (Layout, Nav, etc) and is stored at frontend/public/locales/{locale}/common.json
Namespaces (scopes, domains) are stored in separate json files at frontend/public/locales/{locale}/{namespace}.json
One namespace can combine the translations keys from several pages with common reusable strings ex. auth
scope collects keys for login
and register
pages.
It is preferred to use for translation keys and extract another level of nesting when the common prefix of the keys is above 3 or makes sense to be separated as new keys might be added in the future.
Namespace is separated with :
Translation nesting levels are separated with .
Words in a translation key are separated with -
domain:pages.nested-level.another-nested-level.translation-key
Usage of translation hook useTranslation
is preferred over usage of <Trans />
component, whenever possible.