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.