diff --git a/docs-for-dev/I18N.md b/docs-for-dev/I18N.md index 22f22e469..983eda1e7 100644 --- a/docs-for-dev/I18N.md +++ b/docs-for-dev/I18N.md @@ -18,6 +18,8 @@ translate the UI. | --- | --- | --- | | Web UI | `web/locales//app.json` (and `common.json` when present) | English, per missing key | | Web language picker | `web/i18n/languages.ts` | — | +| Web date and time formatting | `web/lib/datetime.ts` | English (`en-US`) | +| Desktop shell | `apps/desktop/src/i18n.mjs` | English, per missing key | | Reply-language picker | `web/features/settings/store/response-language-options.ts` (`RESPONSE_LANGUAGE_OPTIONS`) | — | | Runtime normalizer | `deeptutor/services/settings/interface_settings.py` | English | | Reply-language contract | `deeptutor/core/response_languages.py` | English | @@ -49,6 +51,9 @@ that silently serves English on that surface. - Add the code to `normalizeLanguage()` so `fr-FR`, `fr_BE`, etc. resolve. - Load the bundle in `ensureLanguage()` in `web/i18n/init.ts`. - Add `language.` to every catalog. + - Register the appropriate regional locale in `getLocale()` in + `web/lib/datetime.ts`; test actual date and time formatting with an explicit + time zone so the test does not depend on the host's location. 2. **Web catalog** - Create `web/locales//app.json`. If the English tree ships a @@ -96,15 +101,25 @@ that silently serves English on that surface. `deeptutor/api/routers/quiz_judge.py` if the judge should answer in that language. - Add a `_THINKING_NOTICES[code]` entry in - `deeptutor/services/partners/runtime.py`. + `deeptutor/services/partners/runtime.py` and preserve the language through + `PartnerRunner._language()`; otherwise the notice and turn context can + silently fall back to English. + - For explicit book-language requests, add the corresponding cues in + `deeptutor/book/language.py`. If the voice service offers the language, + register it in `deeptutor/services/voice/options.py` too. -7. **Generated contracts** +7. **Desktop shell** + - Add a complete dictionary and register it in `MESSAGES` in + `apps/desktop/src/i18n.mjs`. Preserve interpolation fields and intentional + line breaks, and verify language-region aliases through `resolveLanguage()`. + +8. **Generated contracts** - When changing a schema or language union exposed by the API, run `python scripts/export_frontend_contracts.py`, then `npm --prefix web run contracts:generate` and commit the generated changes. - After editing router source, run `python scripts/build_router_index.py`. -8. **Tests** +9. **Tests** - Add a locale test under `tests/i18n/` that checks catalog coverage, placeholder parity, the language normalizer, the CLI banner, the backend message table and any surface you touched. @@ -114,8 +129,11 @@ that silently serves English on that surface. `web/tests/i18n-audit.spec.ts` in sync; include each locale's plural forms. - Run `npm run typecheck`, `npm run test:node`, `npm run lint`, and the focused Vitest files. - - Run the matching Python locale tests. A first-class locale is expected to - cover every English catalog key, not merely the 65 % audit floor. + - Run all Python locale tests, not only the new language's file: adding + English keys or language labels can break an existing locale's coverage. + A first-class locale must cover every English catalog key, not merely the + 65 % audit floor. Keep each locale's existing terminology consistent. + - Run the desktop shell language tests when adding shell copy. ## Rules that keep languages from half-breaking @@ -151,7 +169,8 @@ npm run test:node From the repository root: ```bash -pytest -q tests/i18n/test__locale.py tests/book/test_overview_copy.py +pytest -q tests/i18n tests/book/test_overview_copy.py +node --test apps/desktop/test/i18n.test.mjs ``` Add adjacent tests for any API, partner, book or judge surface you changed.