fix(i18n): give Dutch users the Dutch editor UI, and hold the language registries together by Jocs · Pull Request #5502 · marktext/marktext · GitHub
Skip to content

fix(i18n): give Dutch users the Dutch editor UI, and hold the language registries together - #5502

Merged
Jocs merged 3 commits into
developfrom
fix/5499-dutch-editor-locale
Sep 22, 2026
Merged

Jocs merged 3 commits into
developfrom
fix/5499-dutch-editor-locale

Conversation

@Jocs

@Jocs Jocs commented Sep 21, 2026

Copy link
Copy Markdown
Member

Closes #5499
Closes #5500

Summary

Dutch was offered as a UI language but never reached the editor engine, so picking Nederlands gave Dutch application chrome and an English editor UI. The cause is structural: adding a language means editing lists in five places that nothing checks against each other, and they have now drifted twice — nl never reached MUYA_LOCALES, and in #5496 ru never reached electronLanguages. Both slipped through green CI.

Changes

refactor(desktop) — lift MUYA_LOCALES / getMuyaLocale out of editor.vue into util/muyaLocale.ts. No behaviour change; it makes the map reachable from a unit test.

fix(i18n) (#5499) — add nl to the three lists it was missing from:

File Was
packages/muya/src/index.ts export { de, en, es, fr, ja, ko, pt, tr, zhCN, zhTW }
packages/desktop/src/types/muya-core.d.ts every locale except nl
util/muyaLocale.ts (MUYA_LOCALES) no nl entry

nl.ts has been complete since #5137 (85/85 keys, name: 'nl') and locales/index.ts exported it all along — only the export hub and the consumers were short, so getMuyaLocale('nl') hit its ?? en fallback.

test(desktop) (#5500) — new language-registries.spec.ts asserting that SUPPORTED_LANGUAGES, the locale JSON files on disk, the Preferences dropdown, MUYA_LOCALES and electronLanguages all describe the same set. Each failure message names the file to edit.

The electronLanguages arm matches on the primary subtag — Electron ships pt-BR/pt-PT rather than a bare pt, and macOS .lproj bundles use an underscore. The yml block is hand-parsed rather than read with js-yaml: no YAML parser is a declared dependency of this package, and using the copy electron-builder hoists into node_modules would be the phantom dependency that broke #5159.

What the user sees

Before, with Nederlands selected: menus, preferences, dialogs and sidebar in Dutch; inline format toolbar tooltips, the / quick-insert menu, emoji picker categories, image selector and preview-block strings in English. After: all Dutch.

Verification

Both regressions were reproduced against the new spec before being fixed:

  • removing nl from MUYA_LOCALES → maps every supported language to an engine locale (util/muyaLocale.ts) fails, diff shows - "nl"
  • removing tr from electronLanguages → keeps a resource for every supported language fails with the actionable hint

Local gate, all green: vue-tsc --noEmit, tsc --noEmit (muya), desktop unit 870 passed (66 files), muya unit 1994 passed (256 files), madge --circular src/index.ts clean, ESLint clean on touched files.

Note for reviewers

The electronLanguages arm of the new spec will fail on #5496 as it stands today, which is the point — that PR adds ru everywhere except the packaging whitelist. I have the fix for it ready to push to that branch.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Build artifacts for PR #5502:

Run: https://github.com/marktext/marktext/actions/runs/35680347028

Artifact Size Link
marktext-windows-x64 288.2 MB Download
marktext-macos-x64 298.4 MB Download
marktext-macos-arm64 288.1 MB Download
marktext-linux 640.4 MB Download
marktext-windows-arm64 280.0 MB Download

@Jocs
Jocs force-pushed the fix/5499-dutch-editor-locale branch from 7b06b3a to 574e434 Compare September 22, 2026 02:21
Jocs added a commit that referenced this pull request Sep 22, 2026
…#5504) (#5505)

`copies a 600-level nested list without exhausting the stack` failed
intermittently on CI with RangeError — twice on unrelated PRs (#5496, #5502),
passing on re-run with no code change.

The recursion was in the test, not in `deepClone`. Measured ceilings for the
fixture shape this spec builds:

  deepClone(nested(d)) alone     100000 levels, never threw
  the test body, verbatim        ok <= 900, RangeError @ 1000
  expect(a).not.toBe(b)          ok <= 900, RangeError @ 1000
  structuredClone (the #4747     ok <= 600, throws @ 700
    control)

`expect(copy).not.toBe(state)` hands the whole 600-level structure (~2400
nested containers) to Vitest, which recurses once per level inspecting the
argument. That left a margin of 600 -> ~900, and the ceiling moves with the
Node build and the worker thread's stack size, so CI landed on the wrong side
of it about half the time.

Compare identity outside the matcher so only booleans reach `expect`. With
the fixture raised to 10000 levels the spec now passes; restoring just those
two lines at the same depth reproduces the CI RangeError exactly.

The spec's own comment already warned that "a recursive equality check" would
overflow this input — `expect(deepObject)` is one.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Jocs and others added 3 commits September 22, 2026 10:40
The map from the desktop language preference to the engine's locale objects
lived inside a 2000-line SFC, where no unit test can reach it. Lift it to
`util/muyaLocale.ts` unchanged so the next commits can fix and then guard it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`nl.ts` has been complete since #5137 and `locales/index.ts` exports it, but
`nl` never reached the three lists the desktop reads: the `@muyajs/core`
export hub, the desktop's type surface for it, and MUYA_LOCALES. Picking
Nederlands therefore hit the `?? en` fallback, leaving the inline format
toolbar, quick-insert menu, emoji picker, image selector and preview-block
strings in English while the rest of the app was Dutch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adding a UI language means editing lists in five places that nothing checks
against each other, and they have drifted twice under a green CI run: `nl`
never reached the engine locale map (#5499) and `ru` never reached
`electronLanguages` (#5496).

Assert that SUPPORTED_LANGUAGES, the locale JSON files on disk, the
Preferences dropdown, MUYA_LOCALES and electronLanguages all describe the
same set, and name the file to edit in each failure message. The
electronLanguages arm matches on the primary subtag, since Electron ships
pt-BR/pt-PT rather than a bare `pt`, and spells macOS bundles with an
underscore.

The yml block is hand-parsed: no YAML parser is a declared dependency here,
and reaching for the one electron-builder hoists into node_modules would be
the phantom dependency that broke #5159.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Jocs
Jocs force-pushed the fix/5499-dutch-editor-locale branch from 574e434 to cb94df4 Compare September 22, 2026 02:40
@Jocs
Jocs merged commit 2b4db47 into develop Sep 22, 2026
17 checks passed
@Jocs
Jocs deleted the fix/5499-dutch-editor-locale branch September 22, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nothing keeps the eight language registries in sync Dutch UI language leaves the editor engine in English

1 participant