Localization reference
How SuperDoc matches locale to a language pack, which surfaces follow it, which value wins for a label, plural syntax, fallbacks for languages SuperDoc doesn't ship, and how keys change.
The rules behind locale and translations. To set them up, start with Localize the Editor UI.
For every key and its English text, see Interface strings.
Language matching
SuperDoc matches each tag in locale, in order:
- A pack for the exact tag, such as
pt-BR. - A pack for the tag without its region, keeping the script:
zh-Hant-TWmatcheszh-Hant. - A pack for the base language:
pt-PTmatchespt.
A translations entry for a language SuperDoc does not ship counts as a pack for this matching. If no pack matches a tag,
SuperDoc tries the next one. If none match, it uses English.
If a pack has no text for a label, SuperDoc shows the English text for that label.
The lang attribute
When locale is set, SuperDoc puts the chosen language in the lang attribute of each built-in UI surface, so screen
readers pronounce its labels in that language. Text that comes from the document or from other people, such as comment
bodies, author names, tracked-change excerpts, and custom style names, gets lang="" (unknown). Without locale,
SuperDoc adds no lang attribute.
Coverage
| Area | Follows locale |
|---|---|
| Toolbar, its dropdowns, and the style list | Yes |
| Link, page-number, and AI writer popups | Yes |
| Watermark dialog and presets | Yes |
| Context menu and its panels | Yes |
| Comments, the comments list, and comment timestamps | Yes |
| Search and replace | Yes |
| Table, bookmark, and cross-reference dialogs | Yes |
| Loading screen and header and footer labels | Yes |
| Tracked-change labels in review cards and lists | Yes |
| Accessible names of links, text boxes, and line breaks | Yes |
Built-in style names follow locale, as Word shows them: heading 1 appears as Título 1 in Portuguese and
Spanish. Custom style names stay as the document stores them.
Which value wins
For each label, SuperDoc uses the first value that is set:
- The surface's own option, such as
ui.toolbar.strings,ui.toolbar.texts, orui.search.strings, for the text that option controls. translationsfor the chosen language.- The language pack for
locale. - English.
A surface option covers only the text it controls. For most toolbar buttons, such as Bold, ui.toolbar.strings and
ui.toolbar.texts set only the tooltip, and the accessible name still comes from translations or the pack; to change
both for Bold, set toolbar.bold in translations. The Watermark, Page number, and Comments layout buttons use the
toolbar text for both, so a ui.toolbar.strings value for them also wins for their accessible name.
Existing per-surface options keep working unchanged. Use translations when you want one place for labels across
surfaces. The per-surface options use different keys for the same text: ui.toolbar.strings['font-family'] and
translations.en['toolbar.fontFamily'] set the same tooltip. The
Toolbar and
Search pages list how their keys map.
A watermark preset inserts the text its button shows, so a translations value for watermark.presetDraft,
watermark.presetConfidential, or watermark.presetDoNotCopy also changes the text the preset inserts. See
Watermarks.
Invalid entries
At runtime, SuperDoc ignores a translations entry whose outer key is not a valid language tag and logs a warning.
A value that uses a {placeholder} the English text does not have, such as {nome} where English has {name}, logs a
warning: SuperDoc never fills it, so it shows as written.
Labels with a count
Some labels include a number, such as comments.moreReplies ("3 more replies") and the tracked-change labels for list
items. Their values use ICU plural syntax, so each language chooses the right word form for the count:
const translations = {
'pt-BR': {
'comments.moreReplies': '{count, plural, =0 {Sem respostas} one {Mais # resposta} other {Mais # respostas}}',
},
} satisfies SuperDocTranslations;{count, plural, ...}lists one form per plural category:zero,one,two,few,many, andother. The browser'sIntl.PluralRulespicks the category with the rules of the language the text is written in: a label that falls back to English uses English rules. Every plural needs anotherform. A form the language never uses, such asfewin Portuguese, logs a warning and is kept.=0,=1,=1.5, and other=Nforms match one exact number and take precedence over the category.#is the count, formatted for the language:1.000in Portuguese. Inside a form,#always means the count.- A form can contain other
{placeholders}, such as{name}. - Apostrophes are plain text; SuperDoc does not use ICU's apostrophe quoting. Braces that do not start a placeholder,
such as
{INTERNAL USE}, are also plain text; inside a form, open and close them in pairs.
SuperDoc supports plural only, not select, selectordinal, or number and date formats. If a translations value is
not valid plural syntax, SuperDoc ignores it, logs a warning, and shows the pack's text.
Languages SuperDoc doesn't ship
A translations entry for a language SuperDoc does not ship adds that language; see
Add a language SuperDoc doesn't ship.
localematches your entry the same way it matches a pack:fr-CAuses afrentry. Dates and numbers follow the full tag,fr-CA.- A label your entry does not translate shows the text SuperDoc would show for that tag without your entry: the pack for
the same language, with its own
translationsentry, or English when SuperDoc ships none. Apt-PTentry falls back to Brazilian Portuguese; afrentry falls back to English, including yourtranslations.envalues. - Each label your entry is missing logs one warning, the first time SuperDoc shows it.
- Plural labels use the rules of your language:
{count, plural, one {...} other {...}}picks French forms forfr, where0isone. See Labels with a count. - In a list such as
locale: ['fr', 'pt-BR'], the first language with an entry or a pack wins, even if yourfrentry has one label. Missing labels then fall back to English, not to the next language in the list. - The interface's
langattribute is your tag, so screen readers read every label in that language, including labels that fell back to English. Translate every label your interface shows to avoid mixed-language text.
When keys change
The keys are part of SuperDoc's public API. Within a major version, SuperDoc only adds keys. If a key is renamed, the
old name keeps working until the next major version, and SuperDoc logs a warning that names the new key. Keys are
removed only in a major version. To find the keys a version added, compare its en.json with the previous version's;
see Find keys a new version added.
Recipes
Read the reader's language from your auth provider, i18n library, or server, use locale and translations in React and Vue, and feed labels from your own translation files.
Interface strings
Every built-in label you can translate, with its English text, placeholders, and plural forms, and the en.json file to load into a translation tool.