zh_CN.seed.json covers all 706 portal labels; guard tests check coverage, placeholders and extra keys. npm run i18n:sql writes the SQL that inserts missing rows, sets zh_CN, aligns the four rows with Tastefully English and bumps the catalog version; a test keeps the committed SQL in step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
4.5 KiB
4.5 KiB
Tasks: add-zh-cn-messages
Design: design.md and docs/superpowers/specs/2026-12-02-zh-cn-messages-design.md. Every task is TDD: list the babyboo rules it ports, turn them into failing tests, then build. The owner said no workers (2026-12-02), so everything runs serially in the main session with a self-review per task.
Verify commands:
- Backend:
mvn -T 1C -B -q -pl <modules> -am verify. - Portal:
cd solvway-admin-portal && npx vitest run; echo VITEST=$? && npx tsc --noEmit && npm run lint(check the vitest exit code).
1. Data
- 1.1 SQL:
sql/01-locales.sql(supported_localewith the five languages, English and 简体中文 enabled;catalog_metaat version 0),sql/02-modules.sql(BO_MESSAGES,BO_LOCALESunder System, no role) andsql/99-rollback.sql. Append01and02tolocal/seed/03-colite.sql.- Verify: load the seed into a throwaway local MySQL volume and list the tables and modules.
2. services-system
- 2.1 Language registry: entity, repository, service and
/locale/*controller, with the duplicate, code-locked, English-locked and last-enabled refusals, and the catalog version bump on save and update.- Verify:
mvn -T 1C -B -q -pl solvway-services-system -am verify
- Verify:
- 2.2 Messages:
catalog_metawith/message/catalogVersion;/message/search(searchKey over code,en_US,zh_CN; missingLocale; area; paging);- save refusals (
MsgsCodeAreaLocked,MsgsDuplicateCode); - the version bump on every save and none on a refusal.
- Verify: as 2.1.
3. Gateway
- 3.1 Narrow the token bypass from any
/message/URL to the exact read paths in use (grep the callers first), plus/locale/findAllEnabled. Tests cover open reads and token-gated writes. Security code: read the whole diff.- Verify:
mvn -T 1C -B -q -pl solvway-api-gateway -am verify
- Verify:
4. mobile-api
- 4.1
AdminLocaleControllerand the public/api/public/locales. Refusals pass through as 409 with the reason; locale writes are audited. - 4.2
AdminMessageController: catalog and catalog-version (API key, no session); list and search; detail;PUT(the path id wins); export (audited as a sensitive read); import (match by code ignoring case, per-row summary, audited); moduleBO_MESSAGES; no create and no delete mapping.- Verify (4.1 and 4.2):
mvn -T 1C -B -q -pl solvway-mobile-api -am verify
- Verify (4.1 and 4.2):
5. Portal
- 5.1 Route handlers
app/api/locales/**andapp/api/messages/**,routeModules, sidebar System entries with icons. The language list reloads after sign-in. - 5.2 Languages page
/locales: list, add, edit label and order, code read-only on edit, guarded switch with confirm, inline refusals. - 5.3 Translations page
/messages:- list with code, English and Chinese;
- search, the Missing Chinese filter and its badge;
- the edit panel: placeholder checks, unsaved guard, code read-only;
- export download, and import with preview and summary;
- no add or delete.
- Verify (5.1 to 5.3): portal verify.
6. Chinese
- 6.1
zh_CN.seed.jsonfor everydefaultMessages.tskey, following the glossary in design decision 7. Guard tests: full coverage, equal placeholders, no extra keys. - 6.2 Generator
npm run i18n:sqlwritingsql/03-zh-cn-messages.sql. It upserts zh_CN, inserts missing rows with English, aligns the four English rows and bumps the version. A test checks the committed SQL matches the generator. Mirror it intolocal/seed/04-zh-cn-messages.sql.- Verify: portal verify, then apply the SQL to the local DB and confirm the catalog endpoint returns Chinese for a sample of keys.
7. Release
- 7.1
docs/deployment.md: the SQL order, the modules, the first-pass note for the native-speaker review, and the gateway narrowing. - 7.2 Live Playwright check on the local stack, at 1280 and 360 px:
- switch to 简体中文 and walk every sidebar page;
- English unchanged after sign-in ("Log in");
- edit a translation and see it on the next load;
- a placeholder mismatch blocks Save;
- Missing Chinese filter;
- export, then import with the preview;
- Languages: the English switch is disabled, switching 简体中文 off asks first (cancel);
- a user without the modules gets the not-authorised page.
- 7.3 Whole-branch self-review, then the PR to main and the merge.
Workflow follow-up
- Archive after
add-whatsapp-inboxis archived, since both modify the sidebar requirement. - Tell the owner the Chinese is ready for the native-speaker review, and which screen to use.