Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
docs(ckeditor5): document how editor localization actually works
Elian Doran43af024d9ee5
diff --git a/.claude/skills/ckeditor5-plugin-development/SKILL.md b/.claude/skills/ckeditor5-plugin-development/SKILL.mdindex 7cfae24c77..edd923ffb9 100644--- a/.claude/skills/ckeditor5-plugin-development/SKILL.md+++ b/.claude/skills/ckeditor5-plugin-development/SKILL.md@@ -258,7 +258,7 @@ Load the focused reference for the task at hand:| `references/commands.md` | `Command` patterns: `refresh()`/`execute()`, state (`value`/`isEnabled`), `forceDisabled()`, `affectsData`, command events. || `references/ui-and-localization.md` | Views & templates, component catalog (buttons, inputs, dropdowns, dialogs/modals, balloons, toolbars), icons, `componentFactory`, focus/keystroke management, and `t()` localization. || `references/widgets.md` | Block & inline widgets: `toWidget`/`toWidgetEditable`, nested editables, `insertObject`, widget toolbars, view↔model position mapping, custom properties, and external/async-rendered widgets (UI-element render callbacks, re-render on change, stale-render guard, lazy-load). |-| `references/conventions.md` | Trilium conventions: imports from `ckeditor5`/`@triliumnext` + required file extensions, per-package license/headers (not uniform), `@triliumnext` scope + `workspace:*`, per-package tsconfig, `?raw` icons, `.po` localization, `declare module 'ckeditor5'` augmentation, plus the upstream naming/CSS/BEM/JSDoc/TypeScript rules inherited via `eslint-config-ckeditor5`. For writing idiomatic code and reviewing. |+| `references/conventions.md` | Trilium conventions: imports from `ckeditor5`/`@triliumnext` + required file extensions, per-package license/headers (not uniform), `@triliumnext` scope + `workspace:*`, per-package tsconfig, `?raw` icons, localization via `editor.t()` message ids, `declare module 'ckeditor5'` augmentation, plus the upstream naming/CSS/BEM/JSDoc/TypeScript rules inherited via `eslint-config-ckeditor5`. For writing idiomatic code and reviewing. || `references/tooling-and-packaging.md` | Trilium packaging & wiring: the `@triliumnext/ckeditor5-<feature>` package layout, `workspace:*` deps, `main: src/index.ts` (no per-package dist), tsconfig/eslint/stylelint setup, the full registration flow (`plugins.ts` arrays → editor classes `builtinPlugins` → `toolbar.ts`), the three editor classes, the Vite build, how `apps/client` creates the editor (config, watchdog, lazy premium), and the Inspector. || `references/review-checklist.md` | A structured checklist for reviewing an existing plugin (architecture, schema, conversion, commands, UI, a11y, conventions). || `references/recipes.md` | Task-oriented how-tos: insert content, find/iterate nodes, custom observers, place caret, extend other plugins' UI, etc. |diff --git a/.claude/skills/ckeditor5-plugin-development/references/conventions.md b/.claude/skills/ckeditor5-plugin-development/references/conventions.mdindex ba10240ce1..78c34476f7 100644--- a/.claude/skills/ckeditor5-plugin-development/references/conventions.md+++ b/.claude/skills/ckeditor5-plugin-development/references/conventions.md@@ -111,8 +111,12 @@ extends it for tests.## Localization-User-facing strings go through `editor.t( … )`. Translations live in `lang/en.po` (gettext PO) with-disambiguation/notes in `lang/contexts.json`.+User-facing strings go through `editor.t( … )`, passing **the English text itself** as the message+id. The English entry then goes under `text-editor.ck` in+`apps/client/src/translations/en/translation.json`, keyed by the slug of that text. Two silent+traps: the function must be *named* `t`, and its first argument must be a literal — anything else+renders English forever. There are no `lang/en.po`/`contexts.json` catalogs (removed) and no host+`translate` config (retired). Full rules in `references/ui-and-localization.md`.## Visibility & documentationdiff --git a/.claude/skills/ckeditor5-plugin-development/references/review-checklist.md b/.claude/skills/ckeditor5-plugin-development/references/review-checklist.mdindex 6b6d0831b6..686f3b7b2f 100644--- a/.claude/skills/ckeditor5-plugin-development/references/review-checklist.md+++ b/.claude/skills/ckeditor5-plugin-development/references/review-checklist.md@@ -69,13 +69,24 @@ integration items at the end are specific to this monorepo.## Localization-- [ ] All user-facing strings go through `editor.t()` with a **literal** first argument (string- or object literal), never a variable.-- [ ] New strings have matching entries in the plugin's `lang/en.po` (`msgctxt` + `msgid` +- `msgstr`) **and** `lang/contexts.json` (message id → context). No upstream- `window.CKEDITOR_TRANSLATIONS` / `add()` / webpack-language wiring.-- [ ] Plugins that accept a host `translate` config read it with the identity fallback- (`?? ( key => key )`) so labels degrade gracefully (see collapsible).+- [ ] All user-facing strings go through `editor.t()` with **the English text itself** as the+ message id — no translation keys in plugin code.+- [ ] The translation function is **named `t`** at every call site (`t(…)`, `editor.t(…)`,+ `this.t(…)`). A parameter or local named `translate`/`_t` is invisible to the registry scan,+ so the string never gets translated in any locale.+- [ ] Every first argument is a **literal**, never a variable. Labels held in a table and read as+ `t( def.label )` are the recurring version of this; they belong in a switch+ (`getAdmonitionTitle()`, `getLinkDisplayModeLabel()`, `getBoxSizeLabel()`).+- [ ] Each new message has an English entry under `text-editor.ck` in+ `apps/client/src/translations/en/translation.json`, keyed by the slug of its text — **unless**+ CKEditor already ships that string, in which case there must be **no** entry (ours merges+ after core and would override upstream in every locale).+- [ ] Interpolation uses `%0`/`%1`, not a template literal and not `{{name}}`.+- [ ] Strings that reach **no** translation function at all — the case no test can catch. Read the+ plugin's `label:`/`tooltip:`/`title:`/`placeholder:`/`aria-label` and any text built by+ concatenation or in a `setTemplate` children array.+- [ ] A keystroke mentioned in a message comes from `renderShortcut( editor, SHORTCUT )`, not from+ resolving key names inside the package.## Conventions & hygienediff --git a/.claude/skills/ckeditor5-plugin-development/references/tooling-and-packaging.md b/.claude/skills/ckeditor5-plugin-development/references/tooling-and-packaging.mdindex 0515b3ca6b..be77378b2c 100644--- a/.claude/skills/ckeditor5-plugin-development/references/tooling-and-packaging.md+++ b/.claude/skills/ckeditor5-plugin-development/references/tooling-and-packaging.md@@ -82,8 +82,8 @@ each plugin just ships raw TS via `main: src/index.ts`, compiled by whatever bun`src/` files: `{feature}.ts` (glue), `{feature}editing.ts`, `{feature}ui.ts`, optional`{feature}command.ts`, `augmentation.ts`, `index.ts`. Complex plugins add `constants.ts`(`ELEMENTS`/`ATTRIBUTES`/`COMMANDS`/`CLASSES`), `utils.ts` (model-query helpers), and split-`schema.ts`/`converters.ts`. Assets: `theme/{feature}.css`, `theme/icons/*.svg`, `lang/en.po`-(gettext) + `lang/contexts.json`, `tests/`. License and file headers vary per package — see+`schema.ts`/`converters.ts`. Assets: `theme/{feature}.css`, `theme/icons/*.svg`, `tests/`. (Localization has no+per-plugin files: the English catalog lives in the client — see `references/ui-and-localization.md`.) License and file headers vary per package — see`references/conventions.md`.`index.ts` re-exports the glue plugin, its sub-plugins and command types, and exposes icons:diff --git a/.claude/skills/ckeditor5-plugin-development/references/ui-and-localization.md b/.claude/skills/ckeditor5-plugin-development/references/ui-and-localization.mdindex 4042ef7aa5..ae665e0a46 100644--- a/.claude/skills/ckeditor5-plugin-development/references/ui-and-localization.md+++ b/.claude/skills/ckeditor5-plugin-development/references/ui-and-localization.md@@ -301,61 +301,160 @@ Keys map to platform conventions automatically (e.g. `Ctrl` → `Cmd` on macOS).## Localization with `editor.t()`-Every user-facing string must pass through the editor's translation function so it can be-localized. Trilium ships translations as **gettext PO files per package** — not the upstream-`window.CKEDITOR_TRANSLATIONS` / `add()` / webpack-bundled-language flow.+Every user-facing string must pass through the editor's translation function. Trilium's mechanism is+**the English text is the message id** — there are no translation keys in plugin code, no `.po`+catalogs, and no host `translate` callback. (Both of those existed once; every trace has been+removed. Ignore any older doc that mentions `lang/en.po`, `contexts.json`, `translation_overrides.ts`+or `config.get('translate')`.)-- Get the function from the editor/locale: `const t = editor.t;`, `const { t } = editor.locale;`,- or in a view `const t = this.t;` (`editor.locale.t` is the same function as `editor.t`).-- **First arg must be a string or object literal**, never a variable — the build scans source- for these literals to extract message ids.+```ts+const t = editor.t; // or locale.t, or this.t inside a View+t( 'Insert a table.' );+t( 'Insert footnote %0', index );+```++With no dictionary configured — a test, a standalone editor — `t()` returns the message id, so the+UI renders correct English instead of a raw key. That property is what makes the whole scheme safe.++### The two steps++1. **Call `t()` with the English text** at the point of use.+2. **Add the English entry** under `text-editor.ck` in+ `apps/client/src/translations/en/translation.json`, keyed by the *slug* of that text — lowercase,+ with every run of non-alphanumeric characters collapsed to `-` (`slugify()` in+ `packages/ckeditor5/src/messages.ts`):++ ```jsonc+ "text-editor": { "ck": { "insert-a-table": "Insert a table." } }+ ```++English only. Other locales come from Weblate.++Nothing else is maintained: there is no list of messages, because the English catalog **is** the+registry. `getCkLocale()` turns it into the dictionary CKEditor wants (`buildMessageDictionary()`),+keyed by English text and appended after the core translations.++`apps/client/src/services/i18n.spec.ts` enforces both directions by scanning this package's source —+a message with no entry fails, and an entry no message asks for fails too. Run it with+`pnpm --filter client exec vitest run src/services/i18n.spec.ts`.++### Two traps that fail silently++The scan matches `\bt\(` followed by a **quoted literal**. Both halves matter, and getting either+wrong produces a string that looks localized, passes typecheck, renders fine in English, and is+never translated in any locale:++- **The function has to be named `t`.** `translate('Save')` does not match `\bt\(`; neither does+ `_t('Save')`. `.t(` does, so `editor.t(…)` / `this.t(…)` are fine. If you inject a translator into+ a view or helper, name the parameter `t`.+- **The first argument has to be a literal.** `t( definition.title )` is invisible. This is the+ common failure when labels live in a table:++ ```ts+ // ✗ invisible to the registry — the label reaches t() as a variable+ const MODES = [ { value: 'card', label: 'Card' } ];+ label: t( mode.label )++ // ✓ a switch puts a literal at each call site+ export const MODES = [ 'card', 'embed' ] as const;+ export function getModeLabel( t: ( message: string ) => string, mode: Mode ): string {+ switch ( mode ) {+ case 'card': return t( 'Card' );+ case 'embed': return t( 'Embed' );+ default: return mode; // unrecognized value renders as-is+ }+ }+ ```++ Existing examples: `getAdmonitionTitle()`, `getLinkDisplayModeLabel()`, `getBoxSizeLabel()`.+ Where a helper takes the label ready-made instead (`_createToolbarButton` in mermaid,+ `_registerButton` in image actions), translate at the **call site** and document that the+ parameter arrives translated.++### Upstream messages: call `t()`, add no entry++If CKEditor already ships the string, our dictionary merges **after** the core one, so an entry+would override the upstream translation in every locale. Call `t()` anyway — CKEditor's own catalog+resolves it — but do not add it to `text-editor.ck`. `i18n.spec.ts` recognizes upstream messages and+exempts them from the missing check, so this is only a hazard when adding entries by hand.++Check before adding:++```bash+node --input-type=module -e "const c=(await import('ckeditor5/translations/de.js')).default;+ console.log(new Set(Object.keys(c.de.dictionary)).has('Save'))"+```++Strings found this way so far: `Save`, `Cancel`, `Insert`, `Small`, `Page break`,+`Align left/center/right`, `Justify`, `Block quote`, `Code block`, `Table`, `Horizontal line`,+`Please try a different phrase or check the spelling.`++### Renaming an upstream string++Trilium calls CKEditor's bookmarks "anchors". That is the one case where a message id and its+English text differ, so the pairs are declared in `MESSAGE_OVERRIDES` (`messages.ts`) rather than+discovered — the dictionary must be keyed by the *upstream* id for CKEditor to find it, while the+text comes from our catalog entry for the replacement:```ts-const t = editor.t;-t( 'Admonition' ); // simple-t( 'Insert %0', label ); // placeholder; array also ok-t( { string: '%0 footnote', plural: '%0 footnotes', id: 'N_FOOTNOTES' }, quantity ); // plural-t( { string: '%0', id: 'ACTION_INSERT' }, 'insert' ); // disambiguating id+export const MESSAGE_OVERRIDES: Record<string, string> = {+ "Bookmark": "Anchor",+ "Edit bookmark": "Edit anchor"+};```-### Where translations live+The replacement needs its own English entry like any other message — that is what makes the rename+translatable per locale instead of English-only. A rename also applies when the locale has nothing,+since the English replacement is itself the point. **A plugin Trilium owns never belongs here:**+rename its message id at the call site.-Each Trilium plugin keeps two files under `lang/`:+### Interpolation-- **`lang/en.po`** — the gettext catalog. Each entry is `msgctxt` (translator context) +- `msgid` (the source string passed to `t()`) + `msgstr` (the translation):+`%0`, `%1`, … — CKEditor's convention, not i18next's `{{name}}` and not a template literal:- ```po- msgctxt "Toolbar button tooltip for the Admonition feature."- msgid "Admonition"- msgstr "Admonition"- ```+```ts+t( 'Insert footnote %0', index );+t( 'No templates were found matching "%0".', query );+```-- **`lang/contexts.json`** — maps each message id to a short context string for translators- (mirrors the `msgctxt`):+A placeholder lets a translator move the value; `` `Insert footnote ${index}` `` does not, and is+invisible to the scan besides. Nothing escapes the substituted value, so markup passes through — the+caller is responsible for the sanitizer settings of wherever it lands.- ```json- { "Admonition": "Toolbar button tooltip for the Admonition feature." }- ```+### Code that runs before an editor exists++The slash-command definitions are built by the host, with no editor to ask. They use+`translateMessage( hostTranslate, message, values )` from `messages.ts` — the same key derivation and+the same `%0` substitution, minus the editor:-**Note:** the `.po`/`contexts.json` workflow described above is effectively dormant in Trilium.-The folded-in plugins' `lang/` directories were dropped during consolidation because nothing in the-build or CI consumed them, and none survive. New-user-facing strings reach the UI either through CKEditor's own `t()` dictionary-(`packages/ckeditor5/src/translation_overrides.ts`) or, for Trilium-specific strings, through the-host's `translate` config callback described below.+```ts+const t: MessageTranslateFn = ( message, ...values ) => translateMessage( translate, message, values );+```++Note the local is still named `t`, so the literals at the call sites stay visible to the scan.-### Custom `translate` config fallback+### Keystrokes inside a message-Some Trilium plugins (e.g. collapsible) also accept a `translate` function via editor config,-falling back to the identity function so the string is used verbatim when none is supplied:+Don't resolve key names in this package. Key labels ("Ctrl" is "Strg" in German) live in the+app-wide `keyboard_shortcut_keys` catalog that the command palette and help dialog also read;+duplicating them here would fork fifteen strings and collide with upstream's `Insert`. The host+renders the whole shortcut and the plugin interpolates the markup:```ts-const translate = ( editor.config.get( 'translate' ) as- ( ( key: string, params?: Record<string, unknown> ) => string ) | undefined )- ?? ( ( key: string ) => key );+import { renderShortcut } from '../../shortcut.js';++const title = editor.t( 'Click on the arrow or press %0 to collapse/expand.',+ renderShortcut( editor, TOGGLE_SHORTCUT ) );```-See `packages/ckeditor5/src/plugins/collapsible/collapsible_ui.ts` and `collapsible-editing.ts`. This-is independent of `editor.t()`/PO catalogs — it lets the host (Trilium) inject its own-translator for plugin-specific labels.+`renderShortcut` reads the host's `renderShortcut` editor-config entry and falls back to the stored+form (`"Ctrl+Enter"`) when none is configured. The result is `<kbd>` markup, so the surface showing+it must not sanitize (both current callers set `sanitize: false` on their tooltip).++### What the checks cannot see++`i18n.spec.ts` only knows about strings the scan finds, so a string that reaches **no** translation+function at all is invisible to it — a bare `label: 'Copy to clipboard'` passes every test. A grep+for `label:`/`tooltip:`/`title:`/`placeholder:`/`aria-label` catches most, but not text built by+concatenation or assembled in a `setTemplate` children array. When reviewing a plugin, read its+strings rather than trusting a green suite.diff --git a/.claude/skills/ckeditor5-reviewing/references/defect-patterns.md b/.claude/skills/ckeditor5-reviewing/references/defect-patterns.mdindex 4788918691..ec0fc1e5cf 100644--- a/.claude/skills/ckeditor5-reviewing/references/defect-patterns.md+++ b/.claude/skills/ckeditor5-reviewing/references/defect-patterns.md@@ -161,13 +161,18 @@ group covers the monorepo wiring/convention defects. For the idiomatic "how it s## Localization-**`t()` gaps / misuse.**-- Spot: user-facing strings not wrapped in `t()`; `t` renamed or called on a variable (the static- analyzer only recognizes a literal-arg `t()`); a reused string creating a new source message- instead of aliasing `editor.locale.t`; a new `t('…')` string with no matching entry added to the- plugin's `lang/en.po` (+ `lang/contexts.json` where context disambiguation is needed).-- Fix: wrap all UI strings in `t()` with a literal first arg; reuse via the `locale.t` alias; add the- source string to `lang/en.po` and its context note to `lang/contexts.json`.+**`t()` gaps / misuse.** Trilium passes **the English text itself** as the message id, and a+scan of this package's source (`\bt\(` + a quoted literal) is what drives the English catalog. Three+variants, all of which render fine in English and are never translated anywhere:+- Spot: a user-facing string not wrapped at all (`label: 'Copy to clipboard'`) — no test catches+ this, so read the strings.+- Spot: the translator reached under another name — `translate('Save')`, `_t('Save')`. Does not match+ `\bt\(`. Fix: name the local or parameter `t`.+- Spot: a non-literal first argument — `t( def.label )`, typically because labels sit in a+ `{ value, label }` table. Fix: a switch with a literal per case+ (`getAdmonitionTitle()`, `getLinkDisplayModeLabel()`, `getBoxSizeLabel()`), or translate at the+ call site and pass the label in ready-made.+- Also check interpolation is `%0`, not a template literal or `{{name}}`.## Undo / batching@@ -241,12 +246,16 @@ nothing loads it, no button shows, or lint/license/localization is off.the wrong module declaration doesn't merge and the types are missing.- Fix: `declare module 'ckeditor5'`.-**New UI strings missing from localization.**-- Spot: a new user-facing `t('…')` string with no entry in the plugin's `lang/en.po` (and, where- context matters, `lang/contexts.json`).-- Why: the source catalog is incomplete; downstream translation can't pick the string up.-- Fix: add the string to `lang/en.po` and its context note to `lang/contexts.json`. (See the- Localization group above.)+**New UI strings missing from — or wrongly added to — the English catalog.**+- Spot: a new `t('…')` message with no entry under `text-editor.ck` in+ `apps/client/src/translations/en/translation.json`, keyed by the slug of its English text.+- Spot (the inverse): an entry added for a string **CKEditor already ships**. Our dictionary merges+ after the core one, so that overrides the upstream translation in every locale. Call `t()`, add no+ entry. Verify with the German core dictionary:+ `node --input-type=module -e "const c=(await import('ckeditor5/translations/de.js')).default; console.log(new Set(Object.keys(c.de.dictionary)).has('Save'))"`+- Why: an unentered message renders its English id in every locale and is invisible to Weblate.+- Fix: add (or don't) as above; `pnpm --filter client exec vitest run src/services/i18n.spec.ts`+ checks both directions. (See the Localization group above.)**Test written against the wrong DOM assumptions.**- Spot: a synthetic event dispatched without `cancelable: true` whose `preventDefault()` is thendiff --git a/.claude/skills/ckeditor5-testing/SKILL.md b/.claude/skills/ckeditor5-testing/SKILL.mdindex c5ef831bb4..3042f65394 100644--- a/.claude/skills/ckeditor5-testing/SKILL.md+++ b/.claude/skills/ckeditor5-testing/SKILL.md@@ -128,6 +128,40 @@ Conventions visible here and across the suite:- Pass `licenseKey: 'GPL'` (the kit does this for you). List only the plugins the test needs(commands can also be instantiated directly, e.g. `new InsertMermaidCommand( editor )`).+## Asserting localized strings++Trilium passes the English text itself as the message id (see the **`ckeditor5-plugin-development`**+skill), so a test editor with no dictionary renders **the English text** — assert that literal:++```ts+expect( button.label ).toBe( 'Collapsible block' );+```++Never assert a `text-editor.…` key: that shape belonged to the retired host bridge, and a spec+expecting one is testing a mechanism that no longer exists.++To prove a string really is translatable rather than hardcoded, configure a dictionary. The entry+must be keyed by language, and the leading `{}` is load-bearing — CKEditor merges `translations`+with `reduce(merge)` and no initial value, so without the seed it mutates the first entry:++```ts+editor = await createTestEditor( [ Essentials, Paragraph, Collapsible ], {+ translations: [ {}, { en: { dictionary: { 'Collapsible block': 'Bloc pliabil' } } } ]+} );++expect( createButton( editor ).label ).toBe( 'Bloc pliabil' );+```++`en` because that is the language the editor resolves under when none is configured. Getting the+shape wrong (omitting the language key) throws inside `Locale.t` and fails every spec in the file,+not just the one.++For a helper that takes a translator parameter rather than an editor, pass+`( message: string ) => message` — the same English-fallback behaviour, no editor needed. To observe+*which* messages a plugin asked for, spy with `vi.spyOn( editor, 't' )`: `t` is an own property the+editor assigns in its constructor, so the spy intercepts as long as the code reads `this.editor.t`+per call. Install it before whatever triggers the render.+## Model/view test data`_setModelData()` / `_getModelData()` (and `_getViewData()`) stringify and parse the enginediff --git a/CLAUDE.md b/CLAUDE.mdindex a7be98cc84..6a09554850 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -223,6 +223,34 @@ SQLite via `better-sqlite3`. SQL abstraction in `packages/trilium-core/src/servi- **Electron main process** (e.g. `apps/desktop/src/`): `import { t } from "i18next"` — uses server-side keys from `apps/server/src/assets/translations/en/server.json` (same as server-side). **Never hardcode user-facing strings** in Electron dialogs, tray menus, or IPC handlers — always use `t()`.- **Interpolation**: Use `{{variable}}` for normal interpolation; use `{{- variable}}` (with hyphen) for **unescaped** interpolation when the value contains special characters like quotes that shouldn't be HTML-escaped+#### Text Editor (`packages/ckeditor5`) Translation Usage+The rich-text editor does **not** use i18next keys in plugin code. A plugin passes the **English text itself** to CKEditor's own translation function, and that text *is* the message id:++```ts+const t = editor.t; // or locale.t, or this.t inside a View+t("Insert a table.");+t("Insert footnote %0", index); // %0/%1 placeholders — never a template literal+```++With no dictionary configured (a test, a standalone editor) the message id renders, so the UI is always correct English rather than a raw key. To translate it, add the English entry under `text-editor.ck` in `apps/client/src/translations/en/translation.json`, keyed by the **slug of the English text** (lowercase, every run of non-alphanumerics collapsed to `-`):++```jsonc+"text-editor": { "ck": { "insert-a-table": "Insert a table." } }+```++That is the whole procedure — call site plus English entry. `apps/client/src/services/i18n.spec.ts` enforces it in **both** directions by scanning the editor package's source, so a missing entry and a stale one both fail.++Rules specific to this mechanism:++- **The function must be named `t`.** The scan matches `\bt\(` followed by a quoted literal, so `translate("Save")` or `_t("Save")` is invisible and the string silently stays English in every locale. Name the local or parameter `t` (`.t(` matches too, e.g. `editor.t(…)`).+- **The first argument must be a literal.** `t(definition.title)` is invisible for the same reason. Where labels would otherwise live in a table, use a switch with a literal at each call — see `getAdmonitionTitle()`, `getLinkDisplayModeLabel()`, `getBoxSizeLabel()`.+- **Never add an entry for a string CKEditor already translates.** Our dictionary is merged *after* the core one, so an entry overrides upstream in every locale. Still call `t()` — CKEditor's own catalog resolves it. Check before adding:+ `node --input-type=module -e "const c=(await import('ckeditor5/translations/de.js')).default; console.log(new Set(Object.keys(c.de.dictionary)).has('Save'))"`+- **Renaming an upstream string** (Trilium calls CKEditor's bookmarks "anchors") is the one case where id and text differ: add the pair to `MESSAGE_OVERRIDES` in `packages/ckeditor5/src/messages.ts` and give the replacement its own English entry.+- **Code that runs before an editor exists** (the slash-command definitions) uses `translateMessage(hostTranslate, message, values)` from `messages.ts` — same lookup and same `%0` substitution, minus the editor.+- **A keystroke inside a message** comes from `renderShortcut(editor, SHORTCUT)` (`packages/ckeditor5/src/shortcut.ts`). Key names live in the app-wide `keyboard_shortcut_keys` catalog, which the command palette and help dialog share; don't resolve them inside the package.+- There is no `config.translate` bridge and no `lang/*.po` catalogs any more — both were removed. Any doc or plugin still describing them is stale.+### Electron Desktop App- Desktop entry point: `apps/desktop/src/main.ts`, window management: `apps/desktop/src/services/window.ts`- **Security**: `nodeIntegration` is **disabled** and `contextIsolation` is **enabled**. The renderer has no access to Node.js APIs or Electron internals.