Skip to content

feat(web): the Simplified Chinese catalogue - #565

Open
huhubeibei wants to merge 3 commits into
keptinventory:mainfrom
huhubeibei:feat/zh-hans-catalogue
Open

huhubeibei wants to merge 3 commits into
keptinventory:mainfrom
huhubeibei:feat/zh-hans-catalogue

Conversation

@huhubeibei

Copy link
Copy Markdown

Closes #532.

What

Adds Simplified Chinese (zh-Hans) as a launch language:

  • The full catalogue (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.mjs is green).
  • Registration: lingui.config.ts locales, the catalogue loader, the language picker (own name 简体中文 + flag), and the built-in type and field library in Chinese (@kept/shared's builtin-names.ts).
  • Tests that pin the language list are updated (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.ts gains serverLocale(), which narrows the web locale to the languages the server writes, falling back to English;
  • the report and export language pickers (condition PDF, contents sheets, vehicle history, readable copy) now pass 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.ts zod is a strict enum);
  • LanguageSelect takes 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_LOCALES is the whole change.

Notes

  • The translations are AI-assisted and reviewed mechanically for ICU shape; the catalogue is PO for exactly this review path (Weblate / direct edits), so a native-speaker pass over any string is a one-line change.
  • Locally verified: tsc --noEmit for web, shared and server; scripts/check-i18n.mjs; vitest for prefs, languages and builtin-names; vite build with the bundle and precache budgets (the zh catalogue adds ~10 KB gzip, within budget).

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
@huhubeibei
huhubeibei requested a review from a team as a code owner November 16, 2026 18:00
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@huhubeibei

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Nov 17, 2026
@huhubeibei

Copy link
Copy Markdown
Author

Heads-up on the fast CI check: the unit failure in src/api/vehicles/mock/mock.test.ts:82 (nextDue.estimated expected true, received false) is a time-sensitive test, not caused by this PR.

Verified on a clean worktree of origin/main (52a19f0, no changes from this branch) run today with TZ=Africa/Cairo: the same assertion fails identically. The Corolla mock's odometer readings are fixed while estimatedOn is extrapolated against the real clock, so from 2026-11-18 (Cairo) the extrapolated date passes the fixed dueOn and estimated flips to false on main as well. Same failure, no changes from this branch applied.

Everything else in this PR's CI (lint, catalogues, typecheck, build, e2e shards, db tests) is green.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Simplified Chinese (zh-Hans) localization

1 participant