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
fix(i18n): settle the English catalogues on US spelling
Elian Doran3398e1bbff17
diff --git a/.claude/skills/translating-locales/SKILL.md b/.claude/skills/translating-locales/SKILL.mdindex fa0e419403..2040202c5c 100644--- a/.claude/skills/translating-locales/SKILL.md+++ b/.claude/skills/translating-locales/SKILL.md@@ -9,6 +9,13 @@ Trilium's UI is localized with **i18next**. English is the source of truth; othe**Scope — this skill *fills* an already-registered locale.** To **add a brand-new locale** (e.g. Polish) you must first do the one-time registration and build wiring; that's a separate task. Follow `docs/Developer Guide/Developer Guide/Concepts/Internationalisation Translations/Adding a new locale.md` to register it, then come back here to translate the strings.+**`en-GB` is the exception and must never be filled.** The `en` catalogues are US English, and `en-GB`+carries **only** the strings whose British spelling differs — `"color_type": "Colour"`,+`"centerContent": "Keep content centred"` — falling back to `en` for the rest. So `measure en-GB`+reporting a few percent is the intended state, not a gap: an entry that merely repeats the English is+noise, and `measure` would then report it as untranslated anyway. Use `merge en-GB <catalog> <file>`+for the handful of spelling variants a change introduces, and nothing else.+Every mechanical step is [locale.mjs](locale.mjs) — measure, export, validate, merge, audit. Read [romanian.md](romanian.md) for Romanian grammar and terminology.```bashdiff --git a/.claude/skills/working-with-translations/SKILL.md b/.claude/skills/working-with-translations/SKILL.mdindex 3c0a845f93..4916044e53 100644--- a/.claude/skills/working-with-translations/SKILL.md+++ b/.claude/skills/working-with-translations/SKILL.md@@ -86,6 +86,30 @@ node $S add client dialog.my_thing "Save changes"Then use it: `t("dialog.my_thing")`. Only `en/` changes — Weblate carries the string to the other locales, and you should **not** hand-edit the other ~38 locale files.+### Write US English, and mirror the difference into `en-GB`++The `en` catalogues are **US English**: `color`, `center`, `meter`, `recognize`, `labeled`, `canceled`,+`organize`, `defense`, `gray`. `en-GB` is a locale of its own, and unlike the ~38 translated locales it+is sparse on purpose — it carries **only** the strings whose British spelling differs (`"color_type":+"Colour"`, `"centerContent": "Keep content centred"`), and falls back to `en` for everything else.++So a string containing one of those words is two edits, not one:++```bash+node $S add client dialog.my_thing "Pick a color"+# then, only because the spelling differs:+printf '{"dialog.my_thing":"Pick a colour"}' > /tmp/en-GB.json+node .claude/skills/translating-locales/locale.mjs merge en-GB client /tmp/en-GB.json+```++Leave `en-GB` alone where the spelling is the same in both — an entry identical to English is noise+that `measure` then reports as untranslated. `i18n.mjs` writes `en/` only, by design; `locale.mjs+merge` is the sanctioned way into a locale file, and it preserves key order and formatting.++To check a catalogue, grep its values for the British halves of those pairs — `colour`, `centre`,+`metre`, `-ise`/`-isation`, `-lled`/`-lling`, `defence`, `licence`, `grey`, `programme`, `whilst`.+The English catalogues currently read 0 hits, so anything found is newly introduced.+### Pluralizationi18next pluralizes only when the translation has `_one` / `_other` keys **and** the call site passes `{ count }`. Add both forms and call `t("key", { count })`:diff --git a/CLAUDE.md b/CLAUDE.mdindex a239843a87..b452670abb 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -151,6 +151,7 @@ SQLite (`better-sqlite3` on Node, `@sqlite.org/sqlite-wasm` on OPFS in standalon- English is the only catalogue you edit; 40+ other locales come from Weblate. Three English catalogues, chosen by who loads the string: `apps/client/src/translations/en/translation.json` (the app), `en/entry.json` (`setup.*`, `login.*`, `set_password.*` — the setup/login/password pages load only this ~11 KB file), and `apps/server/src/assets/translations/en/server.json` (server, `trilium-core`, the Electron main process **and** standalone's worker — it is the catalogue for every non-browser-UI runtime, so a `t()` in core needs no fallback). Load the **`working-with-translations` skill** to find, add or audit keys without reading the 226 KB file.- Client: `import { t } from "../services/i18n"`; everywhere else: `import { t } from "i18next"`. Never hardcode user-facing text, including in Electron dialogs/tray/IPC.+- **The `en` catalogues are US English** — `color`, `center`, `meter`, `recognize`, `labeled`, `canceled`. `en-GB` is a locale of its own and carries only the strings whose British spelling differs, so when a new or edited string contains one of those words, add the British form there too (`node .claude/skills/translating-locales/locale.mjs merge en-GB <catalog> <file>`). Leave `en-GB` alone when the spelling is the same in both.- `{{var}}` interpolates escaped; `{{- var}}` unescaped (values with quotes etc.). Interpolated **components** whose order can vary by language (links, note references) use `<Trans>` from `react-i18next`, not `t()`.- Third-party components (mind-map context menu, …) still go through `t()` with their strings under a dedicated namespace (e.g. `"mind-map"`).- **Text editor (`packages/ckeditor5`)**: plugins call `editor.t("English text")` — the English text *is* the message id, the entry lives under `text-editor.ck` keyed by its slug, and `apps/client/src/services/i18n.spec.ts` fails on a missing or stale one. Rules (name it `t`, literal argument, don't shadow upstream strings, `MESSAGE_OVERRIDES`, `renderShortcut`): **`ckeditor5-plugin-development` skill**.diff --git a/apps/client/src/translations/en-GB/entry.json b/apps/client/src/translations/en-GB/entry.jsonindex 0967ef424b..b54dbbf2bc 100644--- a/apps/client/src/translations/en-GB/entry.json+++ b/apps/client/src/translations/en-GB/entry.json@@ -1 +1,5 @@-{}+{+ "setup": {+ "backup-name-description": "Give this backup a name you will recognise later, or keep the suggested one."+ }+}diff --git a/apps/client/src/translations/en-GB/translation.json b/apps/client/src/translations/en-GB/translation.jsonindex 12ae7cceb6..90224cb4aa 100644--- a/apps/client/src/translations/en-GB/translation.json+++ b/apps/client/src/translations/en-GB/translation.json@@ -11,7 +11,9 @@"auto_read_only_disabled": "text/code notes can be set automatically into read mode when they are too large. You can disable this behaviour on per-note basis by adding this label to the note","workspace_tab_background_color": "CSS colour used in the note tab when hoisted to this note","color": "defines colour of the note in note tree, links etc. Use any valid CSS colour value like 'red' or #a13d5f",- "color_type": "Colour"+ "color_type": "Colour",+ "calendar_slot_label_interval": "How often the timeslots of a calendar are labelled, as <code>HH:MM:SS</code>. Defaults to an hour.",+ "slide_background": "The background of a slide, as a colour or as a CSS gradient."},"mobile_detail_menu": {"error_unrecognized_command": "Unrecognised command {{command}}"@@ -235,5 +237,11 @@"bulletList": "<code>*</code> or <code>-</code> followed by space for bullet list","numberedList": "<code>1.</code> or <code>1)</code> followed by space for numbered list","blockQuote": "start a line with <code>></code> followed by space for block quote"+ },+ "fonts": {+ "document_preview_body": "Snipped 4 stems below a node and stood them in water on the sill; the first roots showed after <strong>9 days</strong>. It holds its colour in <em>full sun</em> and fades to green in the shade."+ },+ "sidebar_help": {+ "highlights_configure": "Which formats count is yours to set: bold, italic, underlined, coloured text and text on a background colour can each be listed or left out, from the gear in this card's header. Pressing an entry scrolls the note to it."}}diff --git a/apps/client/src/translations/en/entry.json b/apps/client/src/translations/en/entry.jsonindex e122e0b882..0e5225a80f 100644--- a/apps/client/src/translations/en/entry.json+++ b/apps/client/src/translations/en/entry.json@@ -102,7 +102,7 @@"existing-data-backup-failed": "The backup could not be created.","backup-data": "Backup your Trilium data","backup-name": "Backup name",- "backup-name-description": "Give this backup a name you will recognise later, or keep the suggested one.",+ "backup-name-description": "Give this backup a name you will recognize later, or keep the suggested one.","backup-password": "Password (optional)","backup-password-repeat": "Repeat password","backup-password-description": "If you specify a password, the backup file will be encrypted. Keep the password somewhere safe: without it, the backup cannot be restored.",diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex dde38674c2..1c077ed692 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -749,7 +749,7 @@"calendar_hide_weekends": "Hides Saturday and Sunday from the calendar. Applies whatever its value.","calendar_week_numbers": "Shows the number of the week on the calendar. Applies whatever its value.","calendar_slot_duration": "How long each timeslot of a calendar lasts, as <code>HH:MM:SS</code>. Defaults to 15 minutes.",- "calendar_slot_label_interval": "How often the timeslots of a calendar are labelled, as <code>HH:MM:SS</code>. Defaults to an hour.",+ "calendar_slot_label_interval": "How often the timeslots of a calendar are labeled, as <code>HH:MM:SS</code>. Defaults to an hour.","calendar_title": "Names the attribute an event takes its title from, instead of the note title. Either a label or a relation, written without <code>#</code> or <code>~</code>.","calendar_displayed_attributes": "Comma-delimited attribute names whose values are shown on the event. A relation is shown as the title of the note it points at.","calendar_start_date": "Names the label an event reads its start date from, instead of <code>#startDate</code>. Written without the <code>#</code>.",@@ -771,7 +771,7 @@"map_hide_labels": "Hides the note titles beside the markers on a geo map.","map_cluster": "Gathers markers that are drawn close together into a single numbered bubble, which opens when clicked.","presentation_theme": "Which theme a presentation is shown with.",- "slide_background": "The background of a slide, as a colour or as a CSS gradient.",+ "slide_background": "The background of a slide, as a color or as a CSS gradient.","tab_width": "How many spaces wide one level of indentation is in this code note.","indent_with_tabs": "Indents this code note with tabs rather than spaces.","wrap_lines": "Wraps long lines in this code note instead of scrolling sideways.",@@ -1457,7 +1457,7 @@"attributes_definitions_what": "A definition is the schema behind an attribute name: what kind of value it takes, whether it may be given more than once, and whether it is promoted.","attributes_definitions_promoted": "A promoted attribute is shown on the note itself as a form field rather than being left to this panel. Definitions usually arrive from a template, and each row names the note it lives on.","highlights_what": "The passages this note picks out by their formatting. That is a wider net than it sounds: an ordinary bold or italic sentence counts, not only text you have highlighted.",- "highlights_configure": "Which formats count is yours to set: bold, italic, underlined, coloured text and text on a background colour can each be listed or left out, from the gear in this card's header. Pressing an entry scrolls the note to it.",+ "highlights_configure": "Which formats count is yours to set: bold, italic, underlined, colored text and text on a background color can each be listed or left out, from the gear in this card's header. Pressing an entry scrolls the note to it.","note_map_what": "A map of what this note connects to. The link map draws the internal links and relations going in and out of it; the tree map draws where it sits in the note tree. The switcher in this header chooses between the two.","note_map_interaction": "Hovering a note brings its own connections forward and fades the rest. The expand button opens the same map at the size of the window.","note_paths_what": "A note can sit in more than one place in the note tree at once, and each of those places is listed here as a path.",@@ -1860,7 +1860,7 @@"search_placeholder": "Search fonts","no_fonts_found": "No font matches what you are looking for.","document_preview_heading": "Purple heart cuttings",- "document_preview_body": "Snipped 4 stems below a node and stood them in water on the sill; the first roots showed after <strong>9 days</strong>. It holds its colour in <em>full sun</em> and fades to green in the shade."+ "document_preview_body": "Snipped 4 stems below a node and stood them in water on the sill; the first roots showed after <strong>9 days</strong>. It holds its color in <em>full sun</em> and fades to green in the shade."},"max_content_width": {"title": "Content Width",diff --git a/apps/server/src/assets/translations/en-GB/server.json b/apps/server/src/assets/translations/en-GB/server.jsonindex 33e89e11c7..02b71e6d46 100644--- a/apps/server/src/assets/translations/en-GB/server.json+++ b/apps/server/src/assets/translations/en-GB/server.json@@ -107,5 +107,8 @@"toggle-system-tray-icon": "Toggle System Tray Icon","toggle-zen-mode": "Toggle Zen Mode","switch-to-first-tab": "Switch to First Tab"+ },+ "hidden-subtree": {+ "task-state-cancelled": "Cancelled"}}diff --git a/apps/server/src/assets/translations/en/server.json b/apps/server/src/assets/translations/en/server.jsonindex 646d260c8a..7a46b65cd6 100644--- a/apps/server/src/assets/translations/en/server.json+++ b/apps/server/src/assets/translations/en/server.json@@ -267,7 +267,7 @@"task-state-doing": "Doing","task-state-done": "Done","task-state-maybe": "Maybe",- "task-state-cancelled": "Cancelled",+ "task-state-cancelled": "Canceled","task-state-attr-state-id": "Identifier (required)","task-state-attr-markdown-symbol": "Markdown symbol","task-state-attr-is-completed": "Counts as completed",