feat(i18n): French leaves the core for a translation kind of plugin #38

Closed
gabrielvidal wants to merge 0 commits from translation-plugin into main
pull from: translation-plugin
Owner

Summary

French leaves the core. The app now ships in English only, and a language comes from a new kind of plugin, translation (translation-<lang>): its UI dictionary, the backend's mails / pushes / API errors, and the line that tells an agent to write to a guest in their language. French is the seeded translation-fr plugin (ai-agent-plugins, branch translation-fr). Decided in form translation-fr-plugin_xe02x0.

Key changes

  • backend/plugins/typed_manifest.py: kind translation, operator-only, id translation-<lang>; its block holds the code, names, flag, locale, the agent's prompt line and the paths of the ui and backend JSON dictionaries. Two enabled plugins for one language: the first by id keeps it.
  • backend/plugins/manifest.py: a languages field on any plugin (default ["en"]), shown on the plugin's page.
  • backend/core/i18n.py: tables, the language list, notice variants and the prompt line read the enabled translations. core/i18n_fr.py, frontend/src/i18n/fr/ and FRENCH_LINE are gone.
  • GET /api/i18n/languages and GET /api/i18n/{lang} (ETag) answer without a session, on the guest host too: the sign-in page is translated before anyone is signed in.
  • frontend/src/i18n/: the device keeps a copy of its dictionary and revalidates it in the background. Only the first boot in a language waits for it (4 s at most); any failure is English.
  • Number and currency formatting follow the translation's locale instead of lang() === "fr".
  • backend/core/i18n_keys/{ui,backend}.json: the core's English keys, kept in step by the two i18n tests (UPDATE_I18N_KEYS=1). A translation's page shows translated / missing (listed) / unused / placeholder-mismatch counts.
  • Settings → Display: the language picker lists English plus the installed translations (name and flag from the manifest) and is hidden when there is none. The owner can pick a language too (PUT /api/me {lang}), English by default.
  • Settings → Plugins: a fourth kind, Translations.
  • Seeding picks up translation-* once at start; an uninstall sticks.
  • Mock build: English only.

Key decisions

  • A missing French string no longer fails a core test. The core only keeps its key lists current; the plugins repo's test and the plugin's page flag what is missing.
  • A stored language whose translation is gone reads English and is kept, so reinstalling the plugin brings it back.
  • The owner's language changes their interface only. Pushes, API errors and runs addressed to the owner stay English; their runs get no language line.
  • Pages that were owner-only are still mostly untranslated, so an owner in French sees mixed pages until those strings are translated.
  • Automatic is unchanged for guests: their browser's language when a translation for it is installed, else English.

Changelog

  • Added: translation plugins. A language is now a plugin you install; French is translation-fr, installed automatically.
  • Added: the owner can pick the app's language in Settings → Display.
  • Added: every plugin's page lists the languages it speaks, and a translation's page shows how many strings are missing.
  • Changed: the language picker only appears when a translation is installed.
  • Removed: French built into the core.

Test notes

  • Backend: 170 test modules, each in its own bwrap sandbox. Only test_typed_plugins fails, the same way as on main. I re-ran test_i18n (35), test_gate (15) and test_authz_matrix (2): all pass. test_i18n covers a guest unable to install, disable, reload or remove a translation.
  • Frontend: tsc clean; vitest 1103 pass, 1 fails (FreshContext), already failing on main.
  • Dictionaries compared entry by entry with main: 2,424 UI entries and 113 backend entries, none lost; 49 UI entries changed in spacing only (no-break spaces).
  • Live local hub seeded from the plugins branch, and a zero-plugin hub: screenshots below.
  • Deploy from the Homelab, this PR first: a hub on the old code refuses the translation kind and the languages field, so the plugins PR is reloaded only after this one is live. Not deployed from the EVOX2.

Screenshots

owner-display-picker-open.png
guest-home-fr.png
owner-display-fr.png
display-no-picker-plugin-disabled.png
plugin-page-translation-fr.png
plugin-page-missing-count.png
plugin-page-languages-row.png
zero-plugin-display.png

## Summary French leaves the core. The app now ships in English only, and a language comes from a new kind of plugin, `translation` (`translation-<lang>`): its UI dictionary, the backend's mails / pushes / API errors, and the line that tells an agent to write to a guest in their language. French is the seeded `translation-fr` plugin (ai-agent-plugins, branch `translation-fr`). Decided in form `translation-fr-plugin_xe02x0`. ## Key changes - `backend/plugins/typed_manifest.py`: kind `translation`, operator-only, id `translation-<lang>`; its block holds the code, names, flag, locale, the agent's prompt line and the paths of the `ui` and `backend` JSON dictionaries. Two enabled plugins for one language: the first by id keeps it. - `backend/plugins/manifest.py`: a `languages` field on any plugin (default `["en"]`), shown on the plugin's page. - `backend/core/i18n.py`: tables, the language list, notice variants and the prompt line read the enabled translations. `core/i18n_fr.py`, `frontend/src/i18n/fr/` and `FRENCH_LINE` are gone. - `GET /api/i18n/languages` and `GET /api/i18n/{lang}` (ETag) answer without a session, on the guest host too: the sign-in page is translated before anyone is signed in. - `frontend/src/i18n/`: the device keeps a copy of its dictionary and revalidates it in the background. Only the first boot in a language waits for it (4 s at most); any failure is English. - Number and currency formatting follow the translation's locale instead of `lang() === "fr"`. - `backend/core/i18n_keys/{ui,backend}.json`: the core's English keys, kept in step by the two i18n tests (`UPDATE_I18N_KEYS=1`). A translation's page shows translated / missing (listed) / unused / placeholder-mismatch counts. - Settings → Display: the language picker lists English plus the installed translations (name and flag from the manifest) and is hidden when there is none. The owner can pick a language too (`PUT /api/me {lang}`), English by default. - Settings → Plugins: a fourth kind, Translations. - Seeding picks up `translation-*` once at start; an uninstall sticks. - Mock build: English only. ## Key decisions - **A missing French string no longer fails a core test.** The core only keeps its key lists current; the plugins repo's test and the plugin's page flag what is missing. - **A stored language whose translation is gone reads English and is kept**, so reinstalling the plugin brings it back. - **The owner's language changes their interface only.** Pushes, API errors and runs addressed to the owner stay English; their runs get no language line. - **Pages that were owner-only are still mostly untranslated**, so an owner in French sees mixed pages until those strings are translated. - **Automatic is unchanged for guests**: their browser's language when a translation for it is installed, else English. ## Changelog - Added: translation plugins. A language is now a plugin you install; French is `translation-fr`, installed automatically. - Added: the owner can pick the app's language in Settings → Display. - Added: every plugin's page lists the languages it speaks, and a translation's page shows how many strings are missing. - Changed: the language picker only appears when a translation is installed. - Removed: French built into the core. ## Test notes - Backend: 170 test modules, each in its own bwrap sandbox. Only `test_typed_plugins` fails, the same way as on `main`. I re-ran `test_i18n` (35), `test_gate` (15) and `test_authz_matrix` (2): all pass. `test_i18n` covers a guest unable to install, disable, reload or remove a translation. - Frontend: `tsc` clean; vitest 1103 pass, 1 fails (`FreshContext`), already failing on `main`. - Dictionaries compared entry by entry with `main`: 2,424 UI entries and 113 backend entries, none lost; 49 UI entries changed in spacing only (no-break spaces). - Live local hub seeded from the plugins branch, and a zero-plugin hub: screenshots below. - **Deploy from the Homelab, this PR first**: a hub on the old code refuses the `translation` kind and the `languages` field, so the plugins PR is reloaded only after this one is live. Not deployed from the EVOX2. ## Screenshots ![owner-display-picker-open.png](https://git.gabvdl.xyz/attachments/754aed4f-d481-4e14-9218-f060080610ee) ![guest-home-fr.png](https://git.gabvdl.xyz/attachments/4a2132b4-5f1c-44a4-accb-cf4d25d9f699) ![owner-display-fr.png](https://git.gabvdl.xyz/attachments/e77fa39c-db9f-457d-803f-fcce0e61d8a8) ![display-no-picker-plugin-disabled.png](https://git.gabvdl.xyz/attachments/a0a5a7a4-69e3-41dc-84b9-35cd5957407a) ![plugin-page-translation-fr.png](https://git.gabvdl.xyz/attachments/42cb87ac-4261-428c-bc88-215e8155be27) ![plugin-page-missing-count.png](https://git.gabvdl.xyz/attachments/e8a83b1e-4304-4904-b0db-73f11871abec) ![plugin-page-languages-row.png](https://git.gabvdl.xyz/attachments/f4e31a5e-d0d0-4c6b-acf0-dece53e055eb) ![zero-plugin-display.png](https://git.gabvdl.xyz/attachments/8094efbe-cf99-49d6-9958-d4dc369d6e69)
gabrielvidal self-assigned this 2026-11-28 19:09:50 +01:00
gabrielvidal added 1 commit 2026-11-28 19:09:50 +01:00
The core speaks English only; every other language is a kind: "translation" plugin
(translation-<lang>; the French one is translation-fr in ai-agent-plugins, seeded once at start).

- plugins: kind translation (typed_manifest.parse_translation: lang, name, englishName, flag,
  locale, promptLine, ui/backend JSON dictionaries — strict, operator-only, in the fingerprint);
  a top-level "languages" field on any plugin (default ["en"]) shown on its page; seeding takes
  translation-*; plugins/translations.py reads the enabled ones (first by id wins a code).
- core/i18n: tr / langs / localized / clean_pref / effective_lang read the installed
  translations; a pick whose translation is gone reads English and is kept; browserLang records
  any base code. core/i18n_fr.py and FRENCH_LINE are gone (language_line = the plugin's promptLine).
- The owner picks a language too (users.json ownerLang, PUT /api/me {lang}; English by default).
- Public GET /api/i18n/languages and /api/i18n/{lang} (ETag/304), guest host and sign-in included.
- Coverage: backend/core/i18n_keys/{ui,backend}.json (kept by the two i18n tests,
  UPDATE_I18N_KEYS=1); a translation's page shows translated / missing / stale / placeholder
  mismatches.
- Frontend: frontend/src/i18n/fr removed; the dictionary comes from the hub, cached in
  localStorage and revalidated in the background (first boot in a language waits <= 4 s, any
  failure is English); Lang is a string; number/currency style from the translation's locale;
  LanguageSelect lists English + installed translations (hidden when none); Settings → Plugins
  has a Translations kind (tab, catalog filter, group) and a Translation section with the
  missing-strings count; mock is English only.
- Tests: test_i18n.py rewritten on a made-up translation; i18n_testkit.speaking() for the
  tests that need a second language. authz golden, openapi.json + src/generated regenerated;
  docs/plugins.md (Translations), CLAUDE.md, i18n README, docs/settings.md.

Changelog
- Added: languages are plugins — Settings → Plugins → Translations; the owner can pick a language.
- Changed: French moved to the translation-fr plugin (seeded at start: nothing changes for guests).
- Removed: the core's built-in French dictionaries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner
Merged into `main` as 3a6eea54 by the auto-ship batch https://ai-agent.lab.gabvdl.xyz/conversation/cadefe6f-0940-4688-bc56-1306d9265430.
gabrielvidal closed this pull request 2026-11-28 21:10:24 +01:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gabrielvidal/ai-agent#38