i18n: re-sync German UI overlay onto Onyx v4.5.2 + lock to release tag

Client is moving to release v4.5.2 (from the ~v4.3 the overlay was built on) and wants
the pin on a release NUMBER, not a raw commit.

- Re-synced end-user-i18n.patch: cherry-picked PR #12558 onto v4.5.2 and resolved the
  ~25 conflicts from upstream's own refactors. Strategy = never break the UI: kept
  v4.5.2's version for tangled components (they stay English) and hand-merged only the
  two that matter — AppProvider (i18n init + I18nextProvider) and SettingsPage (language
  selector). New i18n infra + all 5 locale dicts merged cleanly. 4 files upstream
  relocated were dropped (no dangling imports — verified).
- Pin to release tag: upstream.pinnedCommit + i18n.baseCommit = v4.5.2 (make setup
  checks out the tag). Regenerated patch applies to pristine v4.5.2 with zero conflicts.
- apply-branding.mjs: idempotent i18n step via a sentinel file (src/lib/i18n.ts), so
  re-running make apply no longer errors once branding has edited the patched files.
- DHI base-image swap now also triggers on v4.5.2 (its Dockerfile uses dhi.io/node).
- README: tag-pin model, coverage caveat, per-release re-sync guidance.

Verified: patch applies clean to v4.5.2; full make apply green (i18n + 201 code + 376
locale replacements); selector + init wired; no leaked conflict markers. Image build to
be run on a stable connection (local build blocked by network).
This commit is contained in:
NaeemDosh 2026-08-07 13:38:15 +05:00
parent 1f2d637263
commit 01b9adfcd9
4 changed files with 274 additions and 1919 deletions

View file

@ -167,11 +167,19 @@ language switcher under Settings → Appearance and **instant** switching. It co
It's wired into the overlay, config-driven from `branding.config.json → i18n`:
- `make apply` `git apply`s `branding/i18n/end-user-i18n.patch` onto the pinned checkout
- **Locked to a release tag** — `upstream.pinnedCommit` and `i18n.baseCommit` are both
set to the same Onyx **release** (currently **`v4.5.2`**), not a raw commit.
- `make apply` `git apply`s `branding/i18n/end-user-i18n.patch` onto that checkout
**before** the branding codemod, then rebrands `Onyx`→`AIDO` inside every bundled
dictionary (`web/public/locales/{de,en,es,fr,pt}/common.json`).
- Because the patch is pinned to its exact base commit
(`i18n.baseCommit == upstream.pinnedCommit`), it applies with **zero conflicts**.
- Because the patch is **re-synced against that exact release** (`i18n.baseCommit`), it
applies with **zero conflicts**. It will *not* apply to a different Onyx version — that's
why the deployment must run the pinned release (see the re-sync note below).
> **Coverage:** most end-user components are translated. Where v4.5.2 refactored a
> component the PR also touched, that component keeps its English text (rather than risk a
> broken UI) — so translation coverage grows over time / with each re-sync, and the app is
> always guaranteed to build and run.
### Editing the German translations
@ -186,10 +194,14 @@ Set `i18n.enabled: false` in `branding.config.json`, bump `upstream.pinnedCommit
forward, and re-run `make setup && make apply`. Your `de/common.json` carries over to the
official feature, so migration is essentially free.
> **Upgrade note:** this is a large feature patch pinned to one commit. Moving to a much
> newer Onyx before official i18n lands needs a re-sync of the patch (regenerate it
> against the new base). `make apply` fails loudly with a clear message if the checkout
> isn't at `i18n.baseCommit`, so it never applies half-way.
> **Upgrade / re-sync note:** this is a large feature patch pinned to one release. To move
> to a newer Onyx while official i18n isn't out yet, the patch must be **re-synced** onto
> the new release tag (cherry-pick PR #12558 onto the tag, resolve conflicts against
> upstream's refactors, regenerate `end-user-i18n.patch`, bump both pins). This is the
> per-release maintenance step — cheapest done **one release at a time** rather than
> skipping several. `make apply` fails loudly if the checkout isn't at `i18n.baseCommit`,
> so it never applies half-way. **Lock your image tags to the pinned release** and only
> move after the re-sync is prepared.
---

View file

@ -63,20 +63,23 @@ if (CONFIG.i18n && CONFIG.i18n.enabled) {
warn(`i18n patch not found at ${patchPath} — skipping`);
} else {
const gitApply = (extra) => execFileSync("git", ["apply", "-p1", ...extra, patchPath], { cwd: ROOT, stdio: "pipe" });
let already = false, ok2 = true;
try { gitApply(["--check"]); }
catch {
try { gitApply(["--reverse", "--check"]); already = true; }
catch { ok2 = false; }
}
if (!ok2) {
console.error(`${c.red}✗ i18n patch does not apply. The checkout must be at i18n.baseCommit (${CONFIG.i18n.baseCommit}). Run \`make setup\` (pinnedCommit is set to that commit), or set i18n.enabled=false.${c.reset}`);
// Idempotency sentinel: the patch adds this file. If it exists the overlay was
// already applied (a later branding pass may have edited the patched files, so a
// reverse-check is unreliable) — skip re-applying.
const sentinel = path.join(WEB, "src/lib/i18n.ts");
if (existsSync(sentinel)) {
ok("i18n patch already applied (found src/lib/i18n.ts) — skipping");
} else {
let applies = true;
try { gitApply(["--check"]); } catch { applies = false; }
if (!applies) {
console.error(`${c.red}✗ i18n patch does not apply. The checkout must be at i18n.baseCommit (${CONFIG.i18n.baseCommit}). Run \`make setup\` (pinnedCommit is set to that tag), or set i18n.enabled=false.${c.reset}`);
process.exit(1);
}
if (already) ok("i18n patch already applied — skipping");
else if (DRY) ok("i18n patch applies cleanly (dry-run, not written)");
if (DRY) ok("i18n patch applies cleanly (dry-run, not written)");
else { gitApply([]); ok(`applied i18n patch — react-i18next, user UI only (Admin stays English); default language ${CONFIG.i18n.defaultLanguage}`); }
}
}
}
// ── 1. Assets: fetch brand images, repoint favicon ──────────────────────────

View file

@ -9,9 +9,9 @@
},
"upstream": {
"$comment": "Pin the exact Onyx commit/tag this overlay is authored against. Pinned to the base commit of the end-user i18n PR (#12558) so its patch applies cleanly (see i18n below). `make setup` checks out this commit. When Onyx merges official i18n, bump this forward and set i18n.enabled=false.",
"$comment": "Pin the exact Onyx release tag this overlay is authored against. `make setup` checks this out. Locked to a release NUMBER (e.g. v4.5.2), not a raw commit. The i18n patch below is re-synced against this exact tag, so it applies cleanly (see i18n). To move to a newer Onyx: re-sync the i18n patch onto the new tag, then bump this. When Onyx ships official i18n, bump this and set i18n.enabled=false.",
"repo": "https://github.com/onyx-dot-app/onyx",
"pinnedCommit": "727e096de85680416bd8d5af0daec3a4f5b407d2",
"pinnedCommit": "v4.5.2",
"webSrcRoot": "web"
},
@ -19,7 +19,7 @@
"$comment": "TEMPORARY end-user internationalization, backported from Onyx PR #12558 (react-i18next; user UI only, Admin stays English) until the official feature ships. apply-branding.mjs git-applies `patch` onto the pinned checkout BEFORE the branding string codemod, then the codemod also rebrands Onyx->AIDO inside the bundled locale dictionaries. Fill/refine translations in web/public/locales/<lang>/common.json. Set enabled=false to drop it once official i18n lands.",
"enabled": true,
"patch": "branding/i18n/end-user-i18n.patch",
"baseCommit": "727e096de85680416bd8d5af0daec3a4f5b407d2",
"baseCommit": "v4.5.2",
"defaultLanguage": "de",
"rebrandLocales": true
},

File diff suppressed because it is too large Load diff