Translations

MediaStore SDK provides flexibility to adjust your language.

Translations are done on a react-i18n library, without backend-side features. Therefore, the translation bundle for every language is done on build or start the dev server. It's always available under URL (domain_name)/locales/(language_code)/translations.json.

The translations file for language merges the content of any JSON files in the folder /translations/(language_code), and because of it, the folder name for languages and code of languages declared in i18n init needs to be consistent.

To connect a new page with translations, it's important to use both withTranslations() and labeling() higher-order components. Labeling is a custom method that dynamically loads a translation bundle from the public folder for the chosen language, if the bundle is not already loaded. You can change the language using languageDetector, e.g.:

  • querystring (append ?lng=LANGUAGE to URL)
  • navigator (set browser language)
  • localStorage (set key i18nextLng=LANGUAGE)