Skip to content

chore: automate language support - #309

Merged
camrun91 merged 11 commits into
mainfrom
language_detection
Jul 31, 2026
Merged

chore: automate language support#309
camrun91 merged 11 commits into
mainfrom
language_detection

Conversation

@camrun91

@camrun91 camrun91 commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Greptile Summary

Automates UI locale registration and keeps generated i18n resources synchronized.

  • Generates the locale resource map from JSON bundles with support for region-qualified locale names.
  • Runs generation before build, test, coverage, typecheck, and Storybook build commands.
  • Watches locale files during UI development and Storybook sessions.
  • Updates browser-language resolution tests, parity checks, documentation, and release metadata.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/ui/scripts/generate-i18n-resources.mjs Generates deterministic locale imports and resource entries and watches locale JSON changes during persistent development commands.
packages/ui/src/i18n/index.ts Replaces manually maintained locale imports with generated resources and re-exports the generated locale metadata.
packages/ui/src/i18n/index.test.ts Derives locale coverage from generated resources and correctly handles region-qualified preference tags.
packages/ui/package.json Integrates one-shot or watched locale generation into the relevant UI package commands.
scripts/check-i18n-parity.mjs Detects generated-resource drift and dynamically checks every non-English locale bundle.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["Locale JSON files"] --> B["generate-i18n-resources.mjs"]
  B --> C["resources.generated.ts"]
  C --> D["i18n instance"]
  D --> E["Browser-language resolution"]
  B -. watch mode .-> F["Development / Storybook reload"]
  C --> G["Build, tests, and typecheck"]
Loading

Reviews (11): Last reviewed commit: "fix: change script and add notes" | Re-trigger Greptile

Context used:

@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 35e7fc0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@youversion/platform-react-ui Patch
vite-react Patch
@youversion/platform-core Patch
@youversion/platform-react-hooks Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread packages/ui/scripts/generate-i18n-resources.mjs Outdated
Comment thread packages/ui/package.json Outdated
Use indexed import bindings and quoted locale keys so codes like
pt-BR do not break the generated i18n resources module.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread packages/ui/scripts/generate-i18n-resources.mjs Outdated
Signed-off-by: Cameron Llewellyn <cameron.b.llewellyn@gmail.com>
Comment thread packages/ui/src/i18n/index.test.ts Outdated
camrun91 and others added 2 commits July 30, 2026 12:11
Emit unquoted locale keys for valid identifiers and single-quoted
keys for region tags (e.g. pt-BR) so lint-staged Prettier no longer
drifts resources.generated.ts. Detect registration via import paths
in the parity check instead of a quoted-key substring.
@camrun91

Copy link
Copy Markdown
Collaborator Author

@greptile-apps can you review again and update your ratting?

camrun91 and others added 3 commits July 30, 2026 15:38
Ensures local typecheck and Storybook use an up-to-date locale map.

Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid constructing invalid tags like pt-BR-PT-BR when supported
locales already include a region, and add a changeset for the
automated locale registration work.
@camrun91
camrun91 requested review from bmanquen and cameronapak July 30, 2026 20:59
cameronapak
cameronapak previously approved these changes Jul 30, 2026

@cameronapak cameronapak left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great and I had one comment cause I think a file that pushed that didn't need to be pushed

Comment thread .cursor/plans/auto_locale_index_8f65bda9.plan.md Outdated
Comment thread packages/ui/package.json Outdated
@camrun91
camrun91 requested a review from cameronapak July 31, 2026 17:08
Comment thread .cursor/plans/auto_locale_index_8f65bda9.plan.md Outdated
Comment thread .changeset/automate-ui-locale-registration.md
Comment thread packages/ui/package.json Outdated
Comment thread scripts/check-i18n-parity.mjs
bmanquen
bmanquen previously approved these changes Jul 31, 2026
@camrun91
camrun91 merged commit 1da7184 into main Jul 31, 2026
14 checks passed
@camrun91
camrun91 deleted the language_detection branch July 31, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants