[GH-ISSUE #5827] Move non-English UI locale packs to their own branch, like docs-i18n #3213

Closed
opened 2026-10-21 06:00:39 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @kolacheee on GitHub (Sep 3, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5827

Originally assigned to: @SpicyMarinara on GitHub.

In one sentence: move the non-English UI locale packs out of the main branch into their own container the way docs/ translations live on docs-i18n, so feature PRs stop having to carry translation work and translators can catch up in batches instead.

What the tax actually is today

Worth being precise, because it is narrower than "every PR must ship translations" but sharper where it bites:

  • Adding a string is already free. A key missing from a pack falls back to English, and check-locales.mjs only reports coverage for it ([localization] pl: 591/9167 keys (6%)).

  • Renaming or deleting a key is not free. check-locales.mjs throws on unknown keys — any key still present in a pack that no longer exists in en.json fails pnpm check outright:

    const unknown = localeKeys.filter((key) => !(key in canonical.messages));
    if (unknown.length > 0) throw new Error(`${locale.filename}: unknown keys: ${unknown.join(", ")}`);
    

    So a PR that renames one UI string has to sweep eleven packs — including ko.json and zh-Hans.json — before it can go green. That is the part that turns a small UI change into a translation chore.

  • Weight and noise. The non-English packs are about 1.9 MB across eleven files (ko 923 KB, zh-Hans 805 KB, pl 55 KB, de 51 KB, then eight smaller ones) against en.json's 860 KB. Every clone, diff, and review carries them, and translation churn sits in the same diffs as feature work.

Why the docs-i18n shape fits

docs-i18n already solves the same problem for prose: one folder per language on a separate branch, a generated manifest.json, packs downloaded into the data folder on demand, and English fallback so features are never blocked on translation. The catch-up workflow ([docs-i18n] <paths> follow-ups) is exactly the batching being asked for here.

The part that makes this smaller than it sounds

The UI packs are already runtime assets, not bundled JSON. locale-loader.ts globs them as URLs:

import.meta.glob<string>("./locales/*.json", { import: "default", query: "?url" })

which is why the build emits them as standalone files (dist/assets/ko-DoyObuap.js is a 0.06 kB shim next to a 923 kB .json). The app already fetches the selected language over HTTP at runtime and already degrades per-key to English. Serving those files from the data folder — where docs packs already land — is a change of location, not an architecture change.

Questions for the maintainer

These are the decisions that shape the work; happy to implement once they are called:

  1. Offline and first run. Docs packs download on demand, which is fine for prose. Is the same acceptable for the UI (English until the pack is fetched), or should packs ship inside releases so a language survives an offline install?
  2. One branch or two. Reuse docs-i18n with a ui/ subtree, or a separate ui-i18n branch? One branch means one catch-up cadence and one place for translators; two keeps the validators and manifests from having to understand both shapes.
  3. Drift policy. A pack built against 2.4.x will eventually carry keys a later release removed. At runtime that already degrades harmlessly (unknown keys are simply never looked up — only the check objects), so drift costs coverage, not correctness. Worth confirming that is the intended contract before the check moves.
  4. Where validation lives. Presumably check-locales.mjs in the main repo validates en.json alone, and a pack validator mirroring scripts/docs-i18n/validate-pack.mjs + build-manifest.mjs moves to the i18n branch. Should coverage percentages still surface somewhere visible so packs do not rot unnoticed?
  5. Docs to follow. CONTRIBUTING.md § Localization and docs/development/localization.md both describe the current in-repo layout, and docs/development/localization.md documents a downloadable Agent handoff that would need repointing.

What this does not change

English stays canonical and in-repo, localization:ui-check still catches hard-coded JSX strings, and the fallback behaviour users see is the same one they see today for any untranslated key.


Decisions (maintainer, 2026-09-04)

Answered, so this is now a plan rather than a proposal:

  1. On-demand download, exactly like the Documentation Language picker. English until the pack is fetched; no packs inside releases.
  2. One branch — reuse docs-i18n. UI packs go in a top-level ui/ folder (ui/ko.json, ui/de.json, …) rather than inside each language folder: build-manifest.mjs/validate-pack.mjs are scoped to a language pack directory and hash everything in it, so a ui.json living inside ko/ would be swept into the docs manifest. A sibling ui/ folder leaves the existing docs tooling untouched, while translators still have one branch and one cadence.
  3. Drift: identical to the docs contract, no special handling. A stale pack degrades to English per key, and renames/deletions must be mirrored or the translation is silently ignored — which is already what the UI loader does at runtime, since a key absent from a pack falls back and a key the app no longer looks up is simply never read.
  4. Validation and coverage: check-locales.mjs stays in the main repo and validates en.json alone (canonical catalog, plus the existing localization:ui-check for hard-coded JSX strings). A ui/ pack validator and the coverage report live on docs-i18n next to the docs validators, so a pack that rots is visible where translators work.
  5. Docs to update (this is all "repointing" meant): CONTRIBUTING.md § Localization and docs/development/localization.md currently document the in-repo layout and pnpm localization:check; after the move they need to describe the ui/ packs and the catch-up workflow the way CONTRIBUTING already documents docs-i18n. docs/development/localization.md also describes a downloadable Agent handoff that points at the in-repo path.

Notes for whoever implements

  • docs-i18n currently carries ten language folders (de es fr hi ja ko pl pt-br ru zh-hans); the app ships eleven non-English UI packs — ar exists in the app but has no docs pack. ui/ can carry ar regardless.
  • Docs folders are lowercase (pt-br, zh-hans) while the app's packs are pt-BR.json, zh-Hans.json. The loader canonicalises filenames through Intl.getCanonicalLocales, but keeping the app's casing in ui/ avoids relying on that.
  • The app-side move is small: locale-loader.ts already fetches packs by URL, so the work is pointing it at the downloaded pack directory (as the docs viewer does) and adding the download/refresh affordance next to the existing UI-language setting.

Rollout (maintainer, decided)

One PR. The download path lands and the in-repo packs are deleted in the same change — no interim release carrying both copies, and no follow-up deletion PR.

Accepted consequence: anyone currently on a non-English UI drops to English on upgrade and re-selects their language to download the pack. That is a one-time minor inconvenience and worth it for the development cycle.

Implementation note that follows from this: the loader must treat "the selected language is no longer present locally" as a normal state, not an error — fall back to English cleanly and point the user at the download, rather than rendering blank or throwing. That path is exercised by every existing non-English user on the upgrade, so it is the first-run case, not an edge case.

ar context: an Arabic docs pack is planned and has simply kept slipping, so a UI pack existing without a docs counterpart is expected and fine.

Originally created by @kolacheee on GitHub (Sep 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5827 Originally assigned to: @SpicyMarinara on GitHub. **In one sentence:** move the non-English UI locale packs out of the main branch into their own container the way `docs/` translations live on `docs-i18n`, so feature PRs stop having to carry translation work and translators can catch up in batches instead. ## What the tax actually is today Worth being precise, because it is narrower than "every PR must ship translations" but sharper where it bites: - **Adding** a string is already free. A key missing from a pack falls back to English, and `check-locales.mjs` only reports coverage for it (`[localization] pl: 591/9167 keys (6%)`). - **Renaming or deleting** a key is not free. `check-locales.mjs` throws on *unknown keys* — any key still present in a pack that no longer exists in `en.json` fails `pnpm check` outright: ```js const unknown = localeKeys.filter((key) => !(key in canonical.messages)); if (unknown.length > 0) throw new Error(`${locale.filename}: unknown keys: ${unknown.join(", ")}`); ``` So a PR that renames one UI string has to sweep eleven packs — including `ko.json` and `zh-Hans.json` — before it can go green. That is the part that turns a small UI change into a translation chore. - **Weight and noise.** The non-English packs are about 1.9 MB across eleven files (`ko` 923 KB, `zh-Hans` 805 KB, `pl` 55 KB, `de` 51 KB, then eight smaller ones) against `en.json`'s 860 KB. Every clone, diff, and review carries them, and translation churn sits in the same diffs as feature work. ## Why the `docs-i18n` shape fits `docs-i18n` already solves the same problem for prose: one folder per language on a separate branch, a generated `manifest.json`, packs downloaded into the data folder on demand, and English fallback so features are never blocked on translation. The catch-up workflow (`[docs-i18n] <paths>` follow-ups) is exactly the batching being asked for here. ## The part that makes this smaller than it sounds The UI packs are **already runtime assets, not bundled JSON**. `locale-loader.ts` globs them as URLs: ```ts import.meta.glob<string>("./locales/*.json", { import: "default", query: "?url" }) ``` which is why the build emits them as standalone files (`dist/assets/ko-DoyObuap.js` is a 0.06 kB shim next to a 923 kB `.json`). The app already fetches the selected language over HTTP at runtime and already degrades per-key to English. Serving those files from the data folder — where docs packs already land — is a change of location, not an architecture change. ## Questions for the maintainer These are the decisions that shape the work; happy to implement once they are called: 1. **Offline and first run.** Docs packs download on demand, which is fine for prose. Is the same acceptable for the UI (English until the pack is fetched), or should packs ship inside releases so a language survives an offline install? 2. **One branch or two.** Reuse `docs-i18n` with a `ui/` subtree, or a separate `ui-i18n` branch? One branch means one catch-up cadence and one place for translators; two keeps the validators and manifests from having to understand both shapes. 3. **Drift policy.** A pack built against 2.4.x will eventually carry keys a later release removed. At runtime that already degrades harmlessly (unknown keys are simply never looked up — only the *check* objects), so drift costs coverage, not correctness. Worth confirming that is the intended contract before the check moves. 4. **Where validation lives.** Presumably `check-locales.mjs` in the main repo validates `en.json` alone, and a pack validator mirroring `scripts/docs-i18n/validate-pack.mjs` + `build-manifest.mjs` moves to the i18n branch. Should coverage percentages still surface somewhere visible so packs do not rot unnoticed? 5. **Docs to follow.** `CONTRIBUTING.md § Localization` and `docs/development/localization.md` both describe the current in-repo layout, and `docs/development/localization.md` documents a downloadable Agent handoff that would need repointing. ## What this does not change English stays canonical and in-repo, `localization:ui-check` still catches hard-coded JSX strings, and the fallback behaviour users see is the same one they see today for any untranslated key. --- ## Decisions (maintainer, 2026-09-04) Answered, so this is now a plan rather than a proposal: 1. **On-demand download**, exactly like the Documentation Language picker. English until the pack is fetched; no packs inside releases. 2. **One branch — reuse `docs-i18n`.** UI packs go in a top-level `ui/` folder (`ui/ko.json`, `ui/de.json`, …) rather than inside each language folder: `build-manifest.mjs`/`validate-pack.mjs` are scoped to a language pack directory and hash everything in it, so a `ui.json` living inside `ko/` would be swept into the docs manifest. A sibling `ui/` folder leaves the existing docs tooling untouched, while translators still have one branch and one cadence. 3. **Drift: identical to the docs contract**, no special handling. A stale pack degrades to English per key, and renames/deletions must be mirrored or the translation is silently ignored — which is already what the UI loader does at runtime, since a key absent from a pack falls back and a key the app no longer looks up is simply never read. 4. **Validation and coverage:** `check-locales.mjs` stays in the main repo and validates `en.json` alone (canonical catalog, plus the existing `localization:ui-check` for hard-coded JSX strings). A `ui/` pack validator and the coverage report live on `docs-i18n` next to the docs validators, so a pack that rots is visible where translators work. 5. **Docs to update** (this is all "repointing" meant): `CONTRIBUTING.md § Localization` and `docs/development/localization.md` currently document the in-repo layout and `pnpm localization:check`; after the move they need to describe the `ui/` packs and the catch-up workflow the way CONTRIBUTING already documents `docs-i18n`. `docs/development/localization.md` also describes a downloadable Agent handoff that points at the in-repo path. ### Notes for whoever implements - `docs-i18n` currently carries ten language folders (`de es fr hi ja ko pl pt-br ru zh-hans`); the app ships **eleven** non-English UI packs — `ar` exists in the app but has no docs pack. `ui/` can carry `ar` regardless. - Docs folders are lowercase (`pt-br`, `zh-hans`) while the app's packs are `pt-BR.json`, `zh-Hans.json`. The loader canonicalises filenames through `Intl.getCanonicalLocales`, but keeping the app's casing in `ui/` avoids relying on that. - The app-side move is small: `locale-loader.ts` already fetches packs by URL, so the work is pointing it at the downloaded pack directory (as the docs viewer does) and adding the download/refresh affordance next to the existing UI-language setting. ### Rollout (maintainer, decided) **One PR.** The download path lands and the in-repo packs are deleted in the same change — no interim release carrying both copies, and no follow-up deletion PR. Accepted consequence: anyone currently on a non-English UI drops to English on upgrade and re-selects their language to download the pack. That is a one-time minor inconvenience and worth it for the development cycle. Implementation note that follows from this: the loader must treat "the selected language is no longer present locally" as a normal state, not an error — fall back to English cleanly and point the user at the download, rather than rendering blank or throwing. That path is exercised by every existing non-English user on the upgrade, so it is the first-run case, not an edge case. `ar` context: an Arabic docs pack is planned and has simply kept slipping, so a UI pack existing without a docs counterpart is expected and fine.
bsakaguchi 2026-10-21 06:00:39 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Sep 5, 2026):

Owner: @SpicyMarinara, implementation by Codex in Issue Sweep PR #5865. I have read the issue and all current comments. Work will target staging, reuse existing code, and include focused regression proof; unrelated open/draft PRs remain untouched.

<!-- gh-comment-id:5551230037 --> @SpicyMarinara commented on GitHub (Sep 5, 2026): Owner: @SpicyMarinara, implementation by Codex in Issue Sweep PR #5865. I have read the issue and all current comments. Work will target staging, reuse existing code, and include focused regression proof; unrelated open/draft PRs remain untouched.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 5, 2026):

Completed on staging in #5865 (merge 314a71a586).

Moved community UI packs to docs-i18n/ui and added explicit download/refresh with offline installed-pack reuse. The content companion #5866 is also merged; Polish, German, and Arabic downloads were verified.

Focused regression proof and manual verification boundaries are documented in the PR. Required checks and the full final regression matrix passed; CodeRabbit completed review with all threads resolved. Closing as completed on staging, not a main release.

<!-- gh-comment-id:5552144599 --> @SpicyMarinara commented on GitHub (Sep 5, 2026): Completed on staging in #5865 (merge 314a71a5862f120284bb24014e401e226be79866). Moved community UI packs to docs-i18n/ui and added explicit download/refresh with offline installed-pack reuse. The content companion #5866 is also merged; Polish, German, and Arabic downloads were verified. Focused regression proof and manual verification boundaries are documented in the PR. Required checks and the full final regression matrix passed; CodeRabbit completed review with all threads resolved. Closing as completed on staging, not a main release.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#3213
No description provided.