-
Notifications
You must be signed in to change notification settings - Fork 58
How to add a new language
Daniel Kmak edited this page Mar 5, 2020
·
1 revision
- Go to
/packages/localization/src/languages
folder and create your language file by copyingen.json
. For example if you create German language file, createde.json
in that directory. - Import your language file in
packages/localization/src/index.ts
and add it to exportedORIGIN_LANGUAGES
constant. - 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;
- 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.