Repository navigation
Conversation
…y locales, plural fallback, proxy, and test cache
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c45c747. Configure here.
This branch has not been deployed
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.

What does this PR do?
Fixes #1155
I addressed all seven deferred follow-up items from the #1148 i18n review:
scripts/i18n.ts,scripts/i18n.test.ts):<followed by a letter,!, or/as a tag (catching<img/src=x onerror=...>,<svg/onload=...>,<!-- -->, and unclosed tags), plus Lingui numbered tags (<0>,</0>,<0/>), while ignoring spaced math comparisons likeWidth < 5 m.tagNestingErrors) to catch broken nesting (<0><1>...</0></1>,</0>...<0>, mismatched or unclosed tags) and renumbered tags (<0>changed to<1>).selectbranch validation (selects) to catch missing or removed branches and missingotherbranches in bothselectandplural/selectordinalselectors.packages/editor/src/i18n/locales.ts,locales/*/index.ts,packages/editor/package.json,apps/editor/app/layout.tsx):@pascal-app/editor/locales/{en,es,fr,ja,zh-CN}) and replaced top-level static imports of all five catalogs inlocales.tswith dynamic per-locale loading (loadBundledLocale,resolveBundledLocale,registerBundledCatalog).apps/editor/app/layout.tsxandclient-bootstrap.tsxto load only the active locale on the server and hand that single catalog to client hydration (avoiding both bundling all five locales up front and hydration mismatches).packages/core/src/i18n/registry.ts,i18n.test.tsx):PascalI18nto resolve each message against a per-fallback-locale Lingui runtime so aptmessage used underpt-PTevaluates withptplural rules (0 -> one) while apt-PToverride usespt-PTplural rules (0 -> other).?lang=navigation (apps/editor/app/client-bootstrap.tsx,apps/editor/lib/ui-locale.ts):<Suspense>-wrappedLocaleQuerySynchook usinguseSearchParams()andresolveClientLangNavigationso client-side navigation to?lang=...switches the active language and dynamically loads its catalog without a full reload, while preserving the SSR default locale on back/internal navigation.proxy()tests (apps/editor/proxy.test.ts):proxy(new NextRequest(...))covering auth gating (307/401 without locale pass-through), forwarded canonicalx-pascal-localeheaders on allowed requests, overwriting client-spoofedx-pascal-localeheaders, and query-string matcher behavior.package.json,apps/editor/package.json,turbo.json):scripts/i18n*.test.tsinto a cached root Turbo task (//#test:i18n-scripts) with explicit inputs and movedapps/editor/proxy.test.tsintoeditor#test, reducing warm reruns from ~66s to a ~72ms Turbo cache hit.How to test
bunx biome checkon the modified files inscripts/,packages/core/,packages/editor/, andapps/editor/.bun test packages/core/src/i18n/ packages/editor/src/i18n/locales.test.ts apps/editor/proxy.test.ts(42 pass, 0 fail).bunx turbo run //#test:i18n-scriptstwice (first run: 72 pass, 0 fail; second run:FULL TURBOcache hit in <100ms).bunx turbo run test --filter=editor(92 pass, 0 fail),bun run check:render-bundle,bun run i18n:check, andbunx turbo run check-types(15/15 packages).Screenshots / screen recording
N/A (i18n validation, per-locale loading, plural fallback, proxy testing, and Turbo test caching).
Checklist
bun devbun checkto verify)mainbranchNote
Medium Risk
Touches core i18n resolution, client hydration/locale switching, and middleware locale headers—user-visible language behavior with moderate complexity but solid test coverage.
Overview
Addresses i18n review follow-ups by lazy-loading bundled locale catalogs (per-locale entry points and
loadBundledLocale/registerBundledCatalog) instead of registering all five packs at startup. The editor SSR loads the active catalog and passes it throughClientBootstrap, withcreateLocaleApplierandLocaleQuerySyncso?lang=changes apply after the chunk loads without a full reload.PascalI18nnow picks the fallback locale’s Lingui runtime per message so ICU plurals use the catalog that supplied the string (e.g.ptvspt-PTforcount: 0).The
i18ncheck pipeline is tighter: richer tag detection and nesting checks, ICU select / pluralotherbranch rules, plus tests.proxy()gains end-to-end locale-header tests; root//#test:i18n-scriptsTurbo task caches script tests separately fromapps/editortests.Reviewed by Cursor Bugbot for commit ef2da6b. Bugbot is set up for automated code reviews on this repo. Configure here.