Repository navigation
feat(web): the Simplified Chinese catalogue - #565
huhubeibei wants to merge 3 commits into
Conversation
Adds zh-Hans as a launch language: the full PO catalogue (every message, with its contexts), the language in the picker with its own name and flag, and the built-in type and field library in Chinese. The server's mail, PDF and readable-copy tables stay as they are, so the report and export pickers now offer only the languages the server writes (prefs' serverLocale narrows the request bodies); Chinese falls back to English there until the server's tables gain it. LanguageSelect takes its choices as a prop to make that difference explicit. Closes keptinventory#532
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
Heads-up on the Verified on a clean worktree of Everything else in this PR's CI (lint, catalogues, typecheck, build, e2e shards, db tests) is green. |
Closes #532.
What
Adds Simplified Chinese (zh-Hans) as a launch language:
apps/web/src/locales/zh/messages.po): every message translated, all 25 contexts kept, every ICU placeholder, tag and plural argument preserved (scripts/check-i18n.mjsis green).lingui.config.tslocales, the catalogue loader, the language picker (own name 简体中文 + flag), and the built-in type and field library in Chinese (@kept/shared'sbuiltin-names.ts).prefs.test.ts,languages.test.tsx).What deliberately stays out
The server's mail, PDF and readable-copy tables (
mail/messages-*.ts,reports/words/*.ts, notify/transparency/assistant tables) keep speaking the eight languages they speak today. Rather than widening those unions with a language they can't write yet:prefs.tsgainsserverLocale(), which narrows the web locale to the languages the server writes, falling back to English;SERVER_LANGUAGES, and their request bodies send the narrowed value — so a Chinese reader's PDFs and mail come out in English instead of a request the server rejects (exports/service.tszod is a strict enum);LanguageSelecttakes its choices as an optional prop (and is generic), which is what makes the interface-language picker and the report pickers differ explicitly.When the server's tables gain Chinese, widening
SERVER_LOCALESis the whole change.Notes
tsc --noEmitfor web, shared and server;scripts/check-i18n.mjs;vitestfor prefs, languages and builtin-names;vite buildwith the bundle and precache budgets (the zh catalogue adds ~10 KB gzip, within budget).