Internationalization
Interface language
locale selects the language pack for menus, tooltips, dialogs, and other translated UI. locales registers language packs without selecting one. This setting belongs to the Univer instance and is shared by all units in the instance. Use LocaleType values, such as LocaleType.EN_US.
- All products: UI:
localechanges translated menus, tooltips, dialogs, and plugin labels. It does not translate user content or rename existing units. - Sheets: cell formats and formulas: When a cell renders a number or date, Univer checks the number-format locale override first, then the workbook snapshot
locale, and finally the instancelocale.regiondoes not replace any of these. Formulas such asDOLLAR, together with the currency format applied to financial results, still followlocale. CJK input normalization behaves the same way. - Docs: statistics:
localedetermines word segmentation and counting.
Changing language at runtime
Load all language packs for the installed plugins or presets before switching. loadLocales() merges translations without changing the current language; setLocale() selects a language without downloading any data. A missing translation key is displayed as the key itself. The example below loads the shared UI pack. If other plugins are installed, merge their target-language packs in the same call.
import { LocaleType, mergeLocales } from '@univerjs/core'import UIEnUS from '@univerjs/ui/locale/en-US'univerAPI.loadLocales(LocaleType.EN_US, mergeLocales(UIEnUS))univerAPI.setLocale(LocaleType.EN_US)console.log(univerAPI.getCurrentLocale()) // enUSMerging language packs
mergeLocales combines language packs from multiple plugins or presets into one complete language pack object:
import { mergeLocales } from '@univerjs/core'// You can pass multiple language pack objects to mergeconst locales = mergeLocales( plugin1Locales, plugin2Locales, presetLocales,)// You can also pass an array of language pack objectsconst locales = mergeLocales([ plugin1Locales, plugin2Locales, presetLocales,])import { mergeLocales } from '@univerjs/presets'// You can pass multiple language pack objects to mergeconst locales = mergeLocales( plugin1Locales, plugin2Locales, presetLocales,)// You can also pass an array of language pack objectsconst locales = mergeLocales([ plugin1Locales, plugin2Locales, presetLocales,])Custom language packs
Univer also supports custom language packs. Assemble a language pack object as needed and pass it to the Univer instance. Preset language packs are generally stored in the <rootDir>/packages/<PLUGIN_NAME>/locale directory.
import { LocaleType, Univer } from '@univerjs/core'const univer = new Univer({ locale: LocaleType.JA_JP, locales: { [LocaleType.JA_JP]: { ui: { shortcut: { undo: '元に戻す', redo: 'やり直す', }, }, }, },})Contributing translations
Univer provides the following built-in language packs:
zh-CN: Simplified Chineseen-US: Englishzh-TW: Traditional Chinesezh-HK: Traditional Chinese (Hong Kong)ru-RU: Russianvi-VN: Vietnamesefa-IR: Persianfr-FR: Frenchja-JP: Japaneseko-KR: Koreanes-ES: Spanishca-ES: Catalansk-SK: Slovakianar-SA: Arabicde-DE: Germanid-ID: Indonesianit-IT: Italianpl-PL: Polishpt-BR: Portuguese (Brazilian)
Other languages are not supported yet. Univer is an open source project, and developers from all regions are welcome to add or improve language packs.
Regional settings
region selects the regional conventions used by regional features. Like locale, it belongs to the Univer instance and is shared by all units in the instance.
Both settings take LocaleType values. For example, the value of LocaleType.EN_US is enUS, while en-US is the language-pack file name and the BCP 47 tag. Do not pass country codes such as US or SG as region. When the UI uses a different language, the region does not require its own language pack.
When region is not set explicitly, it follows locale, including subsequent setLocale() calls. If region is set at initialization or setRegion() has been called, automatic following stops, and later language changes retain the selected region. No public API restores automatic following; when both values should change together, set both of them.
To keep the UI language while using German regional conventions, add region: LocaleType.DE_DE next to locale in createUniver() or new Univer().
import { LocaleType } from '@univerjs/core'univerAPI.setRegion(LocaleType.DE_DE)univerAPI.setLocale(LocaleType.EN_US)console.log(univerAPI.getCurrentRegion()) // deDEHere the UI is English and regional formatting remains German. getCurrentLocale() and getCurrentRegion() return the effective identifiers. To change both at once, call both setters with the same LocaleType value.
- Sheets: currency controls:
regionselects the currency toolbar icon, the currency and accounting options and previews, and the format applied by the currency command. Changing the region does not rewrite existing cell formats or convert monetary values. - Docs: statistics:
regionformats the numbers displayed in the statistics dialog and the status bar, for example the grouping separators. Changingregiondoes not change the counting rules. - Thread comments, when enabled:
regiondetermines how dates and times are displayed, using 24-hour time and Latin digits;localedetermines the comment UI text. Neither changes stored timestamps, andregionis not a timezone setting. - Boards, Slides, Bases, PDFs:
localecontrols the translated UI.regionis available to shared features that consume it, such as thread comments when integrated. It does not automatically reformat board or slide text, Base fields, or PDF content.
Right-to-left layout
Caution
RTL currently covers the UI layer only. The rendering layer does not support RTL.
Caution
Not every plugin provides a language pack. Each feature page states whether it does.
univerAPI.setDirection('rtl')How is this guide?