fix(i18n): stop React Compiler from showing raw message ids, and catch it in check:i18n
What & why
The download page shows RaI2t2 and 1Veav0 where the step 2 and 3 captions should be. They aren't missing translations: the build asks for ids that no catalog has.
Next runs React Compiler before the Lingui SWC macro. The compiler moves parts of some messages into memo temps, so the macro builds a different message than lingui extract saw:
// shipped download-page chunk
i = jsx("strong", { children: "Paradev" }) // hoisted by React Compiler
jsx(Trans, { id: "1Veav0", values: { t6: i }, ... }) // "Open {t6} from your <0>Applications</0> folder"
The catalog has "Open <0>Paradev</0> from your <1>Applications</1> folder" (PZcA2S), so Lingui renders the id. check:i18n stayed green because extraction reads the source.
Guard. check:i18n (CI already runs it) now also runs packages/i18n/scripts/check-compiled-ids.ts. For each Next app with reactCompiler: true and the Lingui SWC plugin (marketing, web, api), it builds every macro file in the app and in the workspace packages it depends on (transitively, e.g. @superset/ui) twice, with that app's own Next SWC and @lingui/swc-plugin: once with React Compiler first, once without. It fails on any id that only the compiled build has. It takes about 7 s. An object-valued reactCompiler setting fails the guard instead of being skipped. packages/i18n/README.md has a new "React Compiler" section listing the four patterns and how to fix each.
Every hit it found (13), all fixed without changing English, so no catalog changes:
| Where | Shipped id | Live? | Fix |
|---|---|---|---|
download InstallSteps ×2 | RaI2t2, 1Veav0 | yes | "use no memo": in a <Trans> with 2+ elements, the compiler hoists the first |
AchievementMedal "Earned {date}" | bdQe9j | yes | "use no memo": {formatDate(…)} hoisted |
| web sign-up terms line | eseuna | yes | "use no memo" |
| contact page ×3 | krX29t, goD3fr, zLeWCG | no (server component) | "use no memo" |
GatesSummary, user profile page | _-Z5u4 (empty message) | no (server) | tagged t`…` instead of t({ message: \…` })` |
packages/ui clickable-file-path, StagedChip aria-labels | _-Z5u4 (empty message) | not checked live (web only renders clickable-file-path on its design page) | tagged t`…` |
HeroStats ×2 | {level} became {level_0} | no (server) | rename the shadowing arrow parameter |
Server components aren't compiled today, so those five are latent. They would break the day a client component imports them, so they're fixed too.
How I tested it
- Confirmed the four live ids in the production chunks on paradev.com and app.paradev.com. The guard reproduces them exactly (
RaI2t2,1Veav0,bdQe9j,eseuna). - On main the guard fails with all 13 listed above. With this change it passes:
React Compiler keeps every Lingui message id. bun run check:i18npasses, with no diff inpackages/i18n/locales.biome checkon the changed files passes.typecheckpasses inpackages/i18n,apps/marketingandapps/web.- Not done: a production
next buildwith a look at the download page in a browser.
Checklist
- PR title follows conventional commits (
type(scope): subject) -
bun run lintandbun run typecheckpass (CI fails on lint warnings too) - "Allow edits from maintainers" is checked on fork PRs
- I have signed the CLA (the bot asks on your first PR)
Summary by cubic
Fixes raw Lingui message ids showing where React Compiler rewrites messages before the Lingui SWC macro, and makes check:i18n catch this class of bug. Next runs React Compiler first, so the build can ask for ids no catalog has and the page renders the raw id; extraction reads the source, so check:i18n stayed green.
- All 13 affected messages are fixed without changing English or catalogs:
"use no memo"on five components, taggedt`…`instead oft({ message: … })inGatesSummary, the user profile page, and twopackages/uicomponents, and a renamed shadowing parameter inHeroStats. check:i18nnow builds every macro file in the compiler apps and the workspace packages they build with and without React Compiler, failing when ids differ; it takes about 4.5 seconds longer. README documents the failure patterns and their fixes.
Summary by CodeRabbit
- Documentation
- Added guidance on translation checks, why message IDs can differ between development and compiled builds, and steps to resolve discrepancies while keeping displayed text unchanged.
- Chores
- Expanded translation validation to check for message ID differences that may appear in compiled builds.
- Other
- No changes to displayed wording or user-facing behavior are noted.