Skip to content

How to add a new language

Daniel Kmak edited this page Mar 5, 2020 · 1 revision
  1. Go to /packages/localization/src/languages folder and create your language file by copying en.json. For example if you create German language file, create de.json in that directory.
  2. Import your language file in packages/localization/src/index.ts and add it to exported ORIGIN_LANGUAGES constant.
  3. Go to packages/origin-ui-core/src/components/OriginConfigurationContext.tsx and extend import declaration with added language from '@material-ui/core/locale'. Example:
import { plPL, enUS, deDE } from '@material-ui/core/locale';

Then add this language to map constant used by materialLocale. Example:

const materialLocale =
        {
            pl: plPL,
            en: enUS,
            de: deDE
        }[language] ?? enUS;
  1. Now build the project and run it. If you have configured everything correctly, go to Settings (account/settings) and pick your newly added language.

Tip: You can run build:watch in packages/localization directory to automatically rebuild translations package, as you edit it. This is useful for live-reloading UI to preview localization changes.

Clone this wiki locally