feat(admin): localize the operator app with react-i18next (3/4) - #1362
Open
marcelo-maciel wants to merge 1 commit into
Open
feat(admin): localize the operator app with react-i18next (3/4)#1362marcelo-maciel wants to merge 1 commit into
marcelo-maciel wants to merge 1 commit into
Conversation
Admin slice of the i18n work (split of fullstackhero#1344 as requested in review). Self-contained: it needs nothing from the backend slices, and the backend needs nothing from it. - `react-i18next` wiring in `src/i18n.ts`, language detected from the stored preference and negotiated with the API through `Accept-Language`. - English and Brazilian Portuguese catalogs, split per feature namespace. - Language switcher in the topbar; the chosen language is persisted to the user profile so it survives a reload, and `html[lang]` follows it through a `languageChanged` listener rather than staying pinned to `en`. - Number, date and currency formatting moved to `src/lib/format.ts` so the presentation layer owns formatting. The API stays UI-culture-only. - Impersonation handoff carries `locale` in the URL so an operator keeps their language when landing in the tenant app. Harmless on its own: nothing reads the parameter until the dashboard slice ships. - Playwright specs pin catalog parity (keys and placeholders, both directions), the switcher, formatting and the handoff parameter. The `SSH.NET` pin (`2026.0.0`) rides along because `template-smoke.yml` runs on `clients/**` and builds the scaffolded solution, which fails `restore` with `NU1903` until fullstackhero#1333 merges. It is byte-identical to that PR.
marcelo-maciel
marked this pull request as ready for review
August 17, 2026 04:02
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
clients/adminslice of the i18n work, split out of #1344. 111 files, of which 30 are JSON catalogs. Mostly mechanical, as you predicted.Independent of the backend slices. Nothing here needs the API change, and the API change needs nothing here. It can be reviewed and merged in any order relative to the other three.
clients/adminclients/dashboardWhat is in here
react-i18nextwiring insrc/i18n.ts. The chosen language is persisted to the user profile and sent to the API asAccept-LanguagethroughapiFetch; variants are canonicalised onto a supported tag before the call, so the API never sees a barept.en-USandpt-BRcatalogs, split per feature namespace, held at strict key and placeholder parity in both directions bytests/i18n/parity.spec.ts— a missing or mis-arged translation fails the build instead of shipping English.html[lang]follows the active language through alanguageChangedlistener. The app previously shipped a staticlang="en"that nothing updated, so a Portuguese UI announced itself as English to screen readers and browser translation.src/lib/format.ts). That is the other half of the framework slice's UI-culture-only decision: the API pinsCultureInfo.CurrentCultureto invariant and the app formats numbers, dates and currency itself.localein the URL.StartImpersonationstrips the target'slocaleclaim on purpose, and the two apps normally sit on different origins, so there was no other way to convey it and the API fell through to the dashboard's own browser detection. Harmless on its own: onmainnothing reads the parameter until the dashboard slice lands, and this PR'shandoff-locale.spec.tspasses with only this half present.Testing
Everything below is this slice on its own, at
mainplus these 111 files — not a share of the unsplit branch's totals.npm ci,npm run build(tsc -b+vite build),npx tsc -b tsconfig.tests.jsonandnpm run lint: all exit 0.tests/impersonation/handoff-locale.spec.ts, which passes with only this half of the handoff present.src/Directory.Packages.propsOne backend file in a React PR, which needs explaining.
template-smoke.ymltriggers onpaths: clients/**and runsdotnet buildon the scaffolded solution, and.template.config/template.jsondoes not excludesrc/Tests/**— so a front-end-only PR still restores the full package graph and hitsNU1903/GHSA-q939-rpr3-3284onSSH.NET2025.1.0, pulled transitively by Testcontainers. That advisory failsrestoreonmaintoo, re-verified today at3f2959e6.The pin is byte-identical to #1333, which owns the fix, so both stay mergeable in either order and this copy can simply be dropped once #1333 lands. All four slices carry it for the same reason. Full rationale in the framework PR.
Notes
element detached from the DOM). Three distinct approaches, then stopped rather than paper over it with retries or a longer timeout. The underlying lost update onPUT /identity/profileis tracked in #1359, where theponytail:comments in the topbar point.apiFetch, soAccept-Languageon the negotiate is the browser's. Applies to every session, not just impersonation. Named explicitly inhandoff-locale.spec.tsso any other channel that stops carrying the locale fails the test.Docs (Golden Rule #10)
fullstackhero/docs#238, kept as a single PR covering all four slices —
internationalization.mdxis one page whose sections map across the split. The Frontend (admin and dashboard) section is this slice and the dashboard one: catalogs, language detection and normalization,Accept-Language, the switcher and locale-aware formatting. That PR should merge after the last of the four, so the page never describes code that is not onmainyet.