Skip to content

feat(i18n): add Dutch locale + validation tests + fix existing issues - #5137

Merged
Jocs merged 2 commits into
marktext:developfrom
rkristelijn:feat/locale-nl-v2
Sep 2, 2026
Merged

Jocs merged 2 commits into
marktext:developfrom
rkristelijn:feat/locale-nl-v2

Conversation

@rkristelijn

Copy link
Copy Markdown
Contributor

Summary

Adds Dutch (nl) locale and strict i18n validation tests. Also fixes existing issues in other locales found during implementation.

New: Dutch locale

  • Complete translation for desktop (nl.json, 748 keys) and muya editor (nl.ts)
  • Registered in SUPPORTED_LANGUAGES, language map (nl, nl-NL, nl-BE), and preferences UI
  • Available under Preferences → General → Language → Nederlands

New: locale-validation.spec.ts

Strict test suite with actionable error messages — when it fails, it tells you exactly what to fix:

  • Key parity: shows missing/extra keys with the English value to copy
  • Placeholder variables: shows both strings side-by-side
  • Technical terms: enforces product names stay English (Latin-script locales)
  • No empty values: lists keys needing translation

Fixes to existing locales

  • es.json: Front Matter was incorrectly translated as "Metadatos"
  • fr.json: Front Matter was incorrectly translated as "Métadonnées"
  • All locales: add dutch language entry
  • fr/ja/ko/pt/zh-CN/zh-TW: fix 13 missing placeholder variables (e.g. {name}, {filename})

Documentation in tests

Canonical spelling reference for product names:

Testing

  • pnpm typecheck ✅
  • locale-validation.spec.ts: 35 tests pass ✅
  • localeCompleteness.spec.ts: 45 tests pass ✅

…sting issues

- Add complete Dutch translation (desktop nl.json + muya nl.ts)
- Register nl in SUPPORTED_LANGUAGES, language map (nl, nl-NL, nl-BE), preferences
- Add locale-validation.spec.ts with actionable error messages:
  - Key parity check (missing/extra keys)
  - Placeholder variable preservation
  - Technical terms stay English (Latin-script locales)
  - No empty values
- Update muya localeCompleteness.spec.ts with nl + technical terms check
- Fix existing upstream issues:
  - Front Matter incorrectly translated in es.json and fr.json
  - 13 missing placeholder variables in fr/ja/ko/pt/zh-CN/zh-TW
  - Add 'dutch' language entry to all existing locales

Canonical product name reference (documented in tests):
  - PlantUML (not Plantuml), Mermaid, Vega-Lite, Front Matter, KaTeX, MathJax
@Jocs

Jocs commented Sep 2, 2026

Copy link
Copy Markdown
Member

Thank you very much for such a careful PR.

@Jocs
Jocs merged commit 8b2dc9e into marktext:develop Sep 2, 2026
16 checks passed
Jocs added a commit that referenced this pull request Sep 22, 2026
`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) <[email protected]>
Jocs added a commit that referenced this pull request Sep 22, 2026
`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) <[email protected]>
Jocs added a commit that referenced this pull request Sep 22, 2026
…e registries together (#5502)

* refactor(desktop): move the muya locale map out of editor.vue

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) <[email protected]>

* fix(i18n): give Dutch users the Dutch editor UI (#5499)

`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) <[email protected]>

* test(desktop): hold the language registries to each other (#5500)

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) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Jocs added a commit to rkristelijn/marktext-fork that referenced this pull request Sep 22, 2026
Resolve three conflicts introduced since the branch point (marktext#4874):

- store/editor.ts: keep both new state fields — `activeHeadingSlug` from
  this branch and `selectionWordCount` from develop (marktext#4457).
- editor.vue: keep both `@/util/tocNavigation` imports — develop's
  `getTocHeadingScrollTop` (marktext#5292 TOC scroll alignment) alongside
  `TOP_LEVEL_HEADINGS_SELECTOR`, which is still exported from there.

The locale additions in this branch (`sideBar.toc.expandAll` /
`collapseAll`) already landed on develop via marktext#5137, so all twelve locale
files merged to identical content — including the `nl` and `ru` files
added after this branch point.

Verified on the merge result: `vue-tsc --noEmit` clean, eslint clean
(warnings only), 875/875 desktop unit tests pass.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.

2 participants