English · 简体中文 · 繁體中文 · 日本語 · Français · 한국어 · Español · Русский
This is the source document. Editor subpackages read the same rules through skills/doca-i18n, which may also be installed as $doca-i18n. When this file changes, update the skill's references/contract.md and every installed copy.
Doca 0.3.0 supports eight interface languages. Each language has its own catalog and uses the shared message keys.
Interface copy uses English keys. Chinese, English, and any later language are translations of that key. Do not use a Chinese sentence or a full English sentence as a key.
| Code | Meaning | html lang |
|---|---|---|
zh |
Chinese | zh-CN |
en |
English | en |
zh-Hant |
Traditional Chinese | zh-Hant |
ja |
Japanese | ja |
fr |
French | fr |
ko |
Korean | ko |
es |
Spanish | es |
ru |
Russian | ru |
Allowed codes live in locales in packages/i18n. The site can set a default language. The initial site default is Simplified Chinese. Visitors and users who have not set ui.locale use the site default. A saved user choice wins.
Write endpoints require a code from the table. When matching regional or system language tags, zh-TW, zh-HK, zh-MO, and zh-Hant select Traditional Chinese. Other supported languages match their primary language tag. Workspace reads use the site default for an unrecognized saved value.
A signed-in choice is page state ui.locale. The browser also stores doca.locale in localStorage. Mobile stores it on the device. An assistant can change ui.locale through the existing page_state.
Each page load starts the Web login screen in the administrator's current site default language. Its language selector applies immediately for the current visit. After sign-in, the workspace resolves its language from ui.locale and the site default.
The mobile connection screen opens in English and offers its own language selector. After a successful connection, it uses the site default returned by /bootstrap. The workspace uses the signed-in account's ui.locale, or the current site's default when the account has no language preference.
Catalogs are in packages/i18n. The English catalog en is the source of keys. Every other language must cover exactly the same keys.
t("account.expires", { date })
// en: Expires {date}
// zh: 到期时间:{date}- Keys are lowercase English with dots, grouped by area, for example
nav.trashandsettings.language. - Placeholders are
{name}. Do not split a sentence and concatenate the pieces. - Plurals use
files.count.oneandfiles.count.other. The call is stillt("files.count", { count }). English usesonewhencount === 1andotherotherwise. Chinese may use the same sentence for both. - A missing translation uses English, then the key itself.
- Use each language’s own name in selectors. The native labels come from
localeNames. - Dates and sorting use
Intlfor the active language tag. - Document titles, body text, comments, mail, file names, and user input are not translated.
The web app uses useI18n() for locale, t, and setLocale. Ant Design and Ant Design X follow that locale. Desktop and mobile use the host catalogs. The browser extension remembers its language for that browser. Contributions using the bilingual plugin contract use its English field in the six new languages.
Uncoded user-visible server errors are still Chinese sentences. New validation errors use a stable code such as invalid_locale, and the interface translates it. Existing API errors are not all converted in this version.
New AI image-generation, model-connection, and worker errors use an explicit presentation envelope, serialized into the existing error text fields:
{ type: "system_error", version: 1, code: "image_edit_failed", data: { status: 422 } }Only newly produced, explicitly coded system errors use this format. Historical error text, messages, tool results, reasoning, and stored prompt context are read verbatim; do not scan, translate, convert, or migrate them. Untagged errors remain unchanged. Web and mobile share the systemErrorMessage reader in @doca/i18n. Tagged job errors use useI18n().t; new HTTP errors use the locale selected by the same provider. Unknown codes show a catalogued generic error, while malformed or unsupported envelopes are left unchanged.
AppError.message and model-facing error serialization stay unchanged. Presentation metadata lives outside the error object in a WeakMap. Image failure checkpoints carry a separate structured reason so later task failure can display it without changing the canonical tool feedback. Interface language is never added to the system prompt, tool definitions, or replayed history, preserving the cached model prefix when the user switches languages.
This is the agreed read policy for old plain text and new coded errors; there is no historical-data or database-schema migration. A rollback must stop new envelope writes while retaining the envelope reader and all stored data.
Databases, job checkpoints, event streams, and API responses store stable English codes and structured parameters. They do not store a display sentence in any language. The web and mobile apps turn the code into a title, description, and phase name with the current catalog.
{ code: "folder_available", data: { name: "Research" } }
t("ai.progress.event.folderAvailable", { name: event.data.name })Phases, events, approvals, and error reasons stored as status follow this rule. Compare codes, for example phase === "completed". Do not compare the result of t(...) or a Chinese or English label. User input, model answers, document titles, file names, and web sources stay as written. Do not rewrite natural content into codes.
An editor subpackage keeps its own interface copy. It does not import Doca's catalog or read Doca page state.
The host passes:
<RichTextEditor locale={locale} />locale is a string. The installed editors accept the eight codes in the table. An unrecognized package locale falls back to English.
- Add an optional
locale?: string. When it is omitted, showzh, matching the current Chinese interface. - Keys are stable English identifiers such as
toolbar.boldandfind.replaceAll. - Provide a complete catalog of the same keys for each supported language.
- Placeholders are
{name}. Counts usekey.oneandkey.other, selected bycount. - Changing
localeupdates buttons, menus, placeholders, and hints. It does not rebuild the document, the Y.Doc, the collaboration adapter, or the plugin list. - An optional
messages?: Record<string, string>may override individual keys. Missing keys still use the built-in translation. - Text, formulas, and cell values the user wrote into the document are not translated.
After the installed package's types include locale, the host passes the current locale at the mount site. Do not put locale in a dependency that rebuilds the document, Y.Doc, collaboration adapter, or plugin list.
- Add the code to
locales, and thehtml langvalue. - Add a host catalog with exactly the English keys.
- Add the language's own name, for example
locale.ja. - Add the matching Ant Design locale on the web app.
- Add the same language catalog in every editor subpackage.
ui.localeaccepts the new code because validation reads the samelocaleslist.