feat: Chinese back office, Translations and Languages screens #49

Merged
ngqile merged 15 commits from add-zh-cn-messages into main 2026-12-02 06:28:16 +00:00
Owner

OpenSpec change add-zh-cn-messages. Staff can work in Chinese.

What changes

  • services-system: a language registry (/locale/*) with refusals for a duplicate code, a changed code, switching English off and switching off the last language. Label search with a missing-locale filter. Save refusals. A catalog version that rises on every save.
  • Gateway: the token bypass now covers only the exact label read paths and GET /locale/findAllEnabled, not every /message/ path. A new /locale/** route. Security code: the whole diff was read.
  • mobile-api: AdminLocaleController and AdminMessageController under /api/admin/**, plus GET /api/public/locales.
    • Modules are BO_MESSAGES and BO_LOCALES.
    • Export, import and language writes are audited.
    • Labels cannot be created or deleted.
  • Portal (ported from babyboo): Translations (/messages) and Languages (/locales) pages.
    • Translations has search, the Missing Chinese filter, an edit panel with placeholder checks and an unsaved-changes guard, and export and import with a preview.
    • A language picker is added to the sign-in page.
  • Chinese: first-pass zh_CN for all 706 back-office labels. npm run i18n:sql writes sql/03-zh-cn-messages.sql, which is mirrored into local/seed/04-zh-cn-messages.sql.
  • Docs: docs/deployment.md covers the SQL order (run 03 once), the modules, the gateway narrowing and known gaps.

Verification

  • mvn -T 1C -pl services-system,api-gateway,mobile-api -am verify: green.
  • Portal: vitest 262 files and 1,766 tests pass (exit 0); tsc is clean; lint has 0 errors and 4 warnings, all in files this change does not touch.
  • openspec validate --strict: valid.
  • Live Playwright check on the local stack at 1280 and 360 px. All items in task 7.2 passed except the not-authorised page: no local user without the modules exists, so unit tests cover it.

Known gaps

  • The Chinese has not been reviewed by a native speaker.
  • About 1,700 inherited Tastefully labels show as Missing Chinese. Co-Lite never displays them. A filter for Co-Lite's own labels is a follow-up.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs

OpenSpec change `add-zh-cn-messages`. Staff can work in Chinese. ## What changes - **services-system:** a language registry (`/locale/*`) with refusals for a duplicate code, a changed code, switching English off and switching off the last language. Label search with a missing-locale filter. Save refusals. A catalog version that rises on every save. - **Gateway:** the token bypass now covers only the exact label read paths and `GET /locale/findAllEnabled`, not every `/message/` path. A new `/locale/**` route. Security code: the whole diff was read. - **mobile-api:** `AdminLocaleController` and `AdminMessageController` under `/api/admin/**`, plus `GET /api/public/locales`. - Modules are `BO_MESSAGES` and `BO_LOCALES`. - Export, import and language writes are audited. - Labels cannot be created or deleted. - **Portal (ported from babyboo):** Translations (`/messages`) and Languages (`/locales`) pages. - Translations has search, the Missing Chinese filter, an edit panel with placeholder checks and an unsaved-changes guard, and export and import with a preview. - A language picker is added to the sign-in page. - **Chinese:** first-pass `zh_CN` for all 706 back-office labels. `npm run i18n:sql` writes `sql/03-zh-cn-messages.sql`, which is mirrored into `local/seed/04-zh-cn-messages.sql`. - **Docs:** `docs/deployment.md` covers the SQL order (run 03 once), the modules, the gateway narrowing and known gaps. ## Verification - `mvn -T 1C -pl services-system,api-gateway,mobile-api -am verify`: green. - Portal: vitest 262 files and 1,766 tests pass (exit 0); tsc is clean; lint has 0 errors and 4 warnings, all in files this change does not touch. - `openspec validate --strict`: valid. - Live Playwright check on the local stack at 1280 and 360 px. All items in task 7.2 passed except the not-authorised page: no local user without the modules exists, so unit tests cover it. ## Known gaps - The Chinese has not been reviewed by a native speaker. - About 1,700 inherited Tastefully labels show as Missing Chinese. Co-Lite never displays them. A filter for Co-Lite's own labels is a follow-up. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
ngqile added 15 commits 2026-12-02 06:28:12 +00:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Ported from babyboo locale-registry: a duplicate code, a code change, switching
English off and switching off the last enabled language are refused as 409s
with a message code; every accepted change bumps the catalog version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Ported from babyboo message-admin-api: search over the code, English and Chinese
text; a missing-Chinese filter; a save that refuses a code change or a duplicate
code (409, no longer swallowed) and bumps the catalog version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Any URL containing /message/ skipped the user token, saves included. Only the
catalog reads that services and the sign-in page make stay open now, each an
exact GET path, plus the enabled-language list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Locales list, create and update; public enabled list; message catalog,
version, search, detail, update, export and import. Refusals from
services-system pass through as 409 with their reason code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Ported from babyboo and trimmed to back-office labels: list with search
and the Missing Chinese filter, edit panel with placeholder checks and an
unsaved-changes guard, export, import with preview and summary, and the
Languages page with guarded switches. A blank translation is no longer
treated as an old placeholder mismatch, so Save blocks a broken new one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
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
The language registry answered 404 through the gateway, so the public
language list failed with a 500. Found in the live check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
The spec lists the picker before sign-in, and staff who work in Chinese
need it there. Also makes the Chinese for "Switch off" differ from the
dialog's Close button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
ngqile merged commit 59ad391baa into main 2026-12-02 06:28:16 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ngqile/co-lite#49