Skip to content

Nothing keeps the eight language registries in sync #5500

Closed

Description

@Jocs

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

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions