i18n

How to use i18n to localization NodeJS and Java strings.

How to add supported Languages?

To add a new language to APITable, follow these steps:

  1. Determine the code of the language to be added, for example uk-UA.

  2. Add new language files in the packages/l10n/base/ directory. For example, create a file named strings.uk-UA.json.

  3. List the value keys for translation in the new language file, following the format of strings.en-US.json.

  4. Add the language item in packages/l10n/base/language.manifest.json.

    {
      "en-US": "English",
      "uk-UA": "українська",
      "zh-CN": "简体中文"
    }
  5. Once the translation is complete, execute the command: make settings.

How to contribute translation?

You can modify the markdown files in source code and create a Pull Request directly

Also, for the text of the UI, you can find the specified key in the string file and modify it, the string files are located at(Different languages correspond to different language files):
1. packages/l10n/base/strings.zh-HK.json
2. packages/l10n/base/strings.ja-JP.json
3. ...

For example, if your language setting is “English“ and you saw the word "text" from the UI that was not translated appropriately.

You can locate its string key in the file packages/l10n/base/strings.en-US.json.

It looks like this:

{
  ...,
  "title": "text"
  ...
} 

You can modify its value to "text1":

{
  ...,
  "title": "text1",
  ...
}

Then create a Pull Request.

NodeJS & React

import { t, Strings } from '../../exports/i18n';

const displayText = t(Strings.xxx);

Java