Repository navigation
Closed
Description
Summary
Adding a UI language means hand-editing six parallel registries plus the packaging whitelist, and nothing checks that they agree. Two of them have already drifted.
The registries
| # | Location | What it holds |
|---|---|---|
| 1 | packages/desktop/src/common/i18n.ts — SUPPORTED_LANGUAGES |
language tags the app accepts |
| 2 | packages/desktop/src/renderer/src/prefComponents/general/config.ts — getLanguageOptions() |
the Preferences dropdown |
| 3 | packages/desktop/static/locales/*.json |
the desktop translations on disk |
| 4 | packages/desktop/electron-builder.yml — electronLanguages |
Chromium/AppKit locales kept in the package |
| 5 | packages/muya/src/locales/index.ts |
muya locale modules |
| 6 | packages/muya/src/index.ts |
the @muyajs/core public export hub |
| 7 | packages/desktop/src/types/muya-core.d.ts |
the desktop's type surface for those exports |
| 8 | packages/desktop/src/renderer/src/components/editorWithTabs/editor.vue — MUYA_LOCALES |
desktop language → muya locale map |
The drift is not hypothetical
nlis missing from 6, 7 and 8 → Dutch users get an English editor UI (Dutch UI language leaves the editor engine in English #5499)ruwas added to 1, 2, 3, 5, 6, 7 and 8 in feat(i18n): add Russian (ru) localization #5496 but not to 4, which would have strippedru.lproj/ru.pakfrom packaged builds — the regression fix: #5130 keep Electron locale resources for all supported UI languages #5132 fixed for the other locales
Both slipped through a green CI run.
Proposal
One spec that asserts the registries agree, e.g.
getSupportedLanguages()
≡ getLanguageOptions().map(o => o.value)
≡ the <lang>.json filenames in static/locales
≡ Object.keys(MUYA_LOCALES)
≡ the locale names exported by @muyajs/core
≡ electronLanguages (modulo the pt-BR/pt_BR and zh-CN/zh_CN spelling variants)
packages/muya/src/__tests__/localeCompleteness.spec.ts now does the equivalent inside muya (covers every locale the package exports); this is the cross-package version.
The electronLanguages arm has to read the yml, so it belongs in the desktop unit suite next to locale-validation.spec.ts, which already reads static/locales from disk.
Metadata
Metadata
Assignees
Labels
No labels
Activity
test(desktop): hold the language registries to each other (#5500)
test(desktop): hold the language registries to each other (#5500)
fix(i18n): give Dutch users the Dutch editor UI, and hold the languag…