Localization
Note
Support for localization of Dashboard extensions was added in v3.5.1
The Dashboard uses Lingui, which provides a powerful i18n solution for React:
- ICU MessageFormat support
- Automatic message extraction
- TypeScript integration
- Pluralization support
- Compile-time optimization
Wrap your strings
First you'll need to wrap any strings that need to be localized:
You will mainly make use of the Trans component and the useLingui hook.
Extract translations
Create a lingui.config.js file in your project root, with references to any plugins that need to be localized:
Then extract the translations:
This will output the given locale files in the directories specified in the config file above. In this case:
src/
└── plugins/
└── reviews/
└── dashboard/
└── i18n/
├── en.po
└── de.po
Since we set the "sourceLocale" to be "en", the en.po file will already be complete. You'll then need to
open up the de.po file and add German translations for each of the strings, by filling out the empty msgstr values:
Was this chapter helpful?