Skip to main content

i18n (internationalization and localization)

This project uses react-i18next as internationalization framework, and is configured with ICU format, a widely used standard for message format. This page describes the format and covers the most common use cases, including more complex examples.

react-i18nextis configured in ./src/i18n/index.ts and initiated as an import in main.tsx.

Adding new translationsโ€‹

Translations are stored in ./src/i18n/resources/ as JSON files. Each file represents a language, and the keys are the same across all files. To add a new translation, create a new JSON file with the language code as the filename (e.g. en.json for English), and add the translations as key-value pairs.

NB: All values should be in the ICU format, and every key present in nb.json (master) should be present in all other files.

To check all neccessary keys are present in all files, run:

pnpm --filter frontend i18n:check

This command is also run as part of the CI/CD pipeline.