Skip Navigation

i18n

i18n Resources

Web Module containing UI messages should define them in the src/i18n folder. This folder contains subfolders for specific languages (e.g. src/i18n/en_US for English). In each subfolder, you can find the translations.json file. The keys of this JSON are message identifiers (common to all languages) and the values are language-specific translations:

{
  "MESSAGE": "Test Message"
}

Usage

We can get access to translations via the translations method available in Context.ts (src/code). Let’s start by importing the translations method under the assumption that we are in the src/code folder:

import {t} from './Context';

Then to get translation all we have to do is to call this method passing message identifier:

const message: string = t('MESSAGE');