Internationalization
Piecemeal Installation
From version 0.1.13, Univer no longer includes any locales, all locales are provided by plugins.
If you need to manually add locales, you can refer to the following example, import the corresponding locale as needed and assemble it into an object to pass it to the Univer
instance:
import { LocaleType, merge, Univer } from '@univerjs/core';
import { defaultTheme } from "@univerjs/design";
import DesignEnUS from '@univerjs/design/locale/en-US';
import UIEnUS from '@univerjs/ui/locale/en-US';
import SlidesUIEnUS from '@univerjs/slides-ui/locale/en-US';
const univer = new Univer({
theme: defaultTheme,
locale: LocaleType.EN_US,
locales: {
[LocaleType.EN_US]: merge(
{},
DesignEnUS,
UIEnUS,
SlidesUIEnUS,
),
},
});
Using Custom Locales
Univer also supports custom locales, you can assemble the locale object according to your needs and pass it to the Univer
instance. The preset locales for reference are generally stored in the <rootDir>/packages/<PLUGIN_NAME>/locale
directory.
const univer = new Univer({
theme: defaultTheme,
locale: 'es-ES',
locales: {
'es-ES': {
shortcut: {
undo: 'Deshacer',
redo: 'Rehacer',
}
},
},
});
Contributing Translations
Now, Univer includes the following preset locales:
zh-CN
: Simplified Chineseen-US
: Englishzh-TW
: Traditional Chineseru-RU
: Russianvi-VN
: Vietnamesefa-IR
: Persianfr-FR
: French
Univer OSS is an open source project full of inclusiveness, and we welcome developers from all over the world to add or improve locales for Univer. If you are interested in contributing locales to Univer, please refer to the Contribution Guide.