* Add Spanish localization and persistent GUI language preferences to MemHub Co-authored-by: Cursor <cursoragent@cursor.com> * Extend MemHub Spanish localization to the remaining GUI screens Move the copy of Applications, memory space and map, matters, workbench, call history, handoff and arrival panels into shared contracts catalogs. - Merge domain catalogs without silent overrides: a key shared by two catalogs must have identical Chinese and Spanish texts. - Add Spanish singular variants (`.one`) and count helpers that keep the Chinese numbers exactly as they were rendered before. - Build the Spanish connection prompt from a catalog template; MCP and shell snippets are inserted verbatim, the Chinese prompt is unchanged. - Word host failures at render time so a language switch re-words them. - Unknown text, names, paths and error codes pass through untranslated; unknown graph node types and edge origins keep their previous labels. - Add catalog parity, interpolation, adapter and regression tests. * feat(memhub): add Chinese English Spanish localization Co-authored-by: Nicolas Pirello <nicoalepirello@gmail.com> Co-authored-by: kristinhe <kristinhe@tencent.com> Co-authored-by: Cursor <cursoragent@cursor.com> * style(memhub): satisfy Node workspace lint Co-authored-by: Cursor <cursoragent@cursor.com> * test(memhub): align localization fixtures with current keys Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Nicolas Pirello <nicoalepirello@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: alvinfei <alvinfei@tencent.com> Co-authored-by: kristinhe <kristinhe@tencent.com>
2.8 KiB
MemHub Localization
MemHub ships Simplified Chinese (zh-CN), English (en), and Spanish (es).
Interface language is independent from conversation, memory, extraction, and
search language.
Architecture
@one-memory/i18nowns supported locales, catalogs, locale resolution, interpolation, plural rules, and formatting helpers.- Web owns the active UI preference and reacts immediately without remounting product state.
- Electron persists the preference before Web starts so startup screens, dialogs, menus, and tray items use the same locale.
systemis a preference, not a locale. It resolves a supported system language and falls back to English.- User-authored text, memory content, raw conversations, paths, source names, model names, endpoints, identifiers, and external error bodies are never translated.
The runtime uses i18next for CLDR plural selection, fallback, and
interpolation. Date, number, list, and relative-time formatting use the
platform Intl APIs.
Catalog rules
- Use stable, domain-qualified keys such as
settings.language.titleandsdk.memory.delete.confirm. - Keep the same key and placeholders in every locale.
- Do not use Chinese or English source text as a new key.
- Do not concatenate translated fragments when one message with parameters can express the sentence.
- Keep technical identifiers outside translated messages unless they are explicit interpolation parameters.
- Use the language's own name in selectors:
简体中文,English,Español. - Do not use national flags to represent languages.
Existing compatibility keys are retained while screens move to semantic keys; new code must not add another source-text key.
Adding a language
- Add its BCP 47 locale to
SUPPORTED_LOCALES. - Add a complete catalog with placeholder parity.
- Add locale resolution and fallback tests.
- Add the self-name to the language selector.
- Verify Web and Electron-native surfaces.
- Test long text with a pseudo-locale or deliberately expanded translations.
- For right-to-left languages, set
dirand use logical CSS properties.
A locale contribution should primarily change catalog and locale metadata. Large unrelated component or product-behavior changes belong in separate PRs.
Verification
Run focused tests while developing:
bash scripts/run-tests-isolated.sh pnpm \
--filter @one-memory/i18n exec vitest run
bash scripts/run-tests-isolated.sh pnpm \
--filter @one-memory/web exec vitest run <affected tests>
bash scripts/run-tests-isolated.sh pnpm \
--filter @one-memory/desktop exec vitest run <affected tests>
Catalog tests enforce key coverage, placeholder parity, plural behavior, and safe fallback. Component tests must verify that changing locale does not repeat network requests, lose form state, broaden authorization, or modify user data.