Skip to content

chore: sync react localization from platform-localization - #451

Open
platform-localization-pr-bot[bot] wants to merge 7 commits into
mainfrom
chore/localization-sync-react
Open

platform-localization-pr-bot[bot] wants to merge 7 commits into
mainfrom
chore/localization-sync-react

Conversation

@platform-localization-pr-bot

@platform-localization-pr-bot platform-localization-pr-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Automated localization sync from platform-localization.

  • Platform: React
  • Source ref: 13a69145193a15a63a05633f5f7e3a0291cad89b
  • Workflow: Distribute React Localization

Size limits

Translations stay. ui / YouVersionProvider only and ui / full barrel are still measured and printed by size-limit, with no limit, so locale growth does not fail CI. There is no locale-only skip and no ceiling bump.

Separator, core, hooks, and CSS keep their hard limits. The bundle-size job is plain pnpm size.

@changeset-bot

changeset-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7a5bbf0

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

Locale syncs can grow the two UI JS bundles, so raise those ceilings to measured sizes and fail CI until .size-limit.js is updated on locale-only diffs.

@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.

Review

No Jira. No written spec.

Summary

Standards: 0 must-fix. Spec: 0 must-fix. Primary concern: the check still fails locale-only PRs instead of excluding translations, so please confirm that's the outcome you want.

Review evidence
  • Scope: e239779, diffed against the merge-base with main. Intent comes from the author's note in the review request ("exclude the translations files from the size check") and the commit message. The PR body is the bot's sync template.
  • Method: I traced scripts/check-bundle-size.mjs, scripts/bundle-size-policy.mjs, the CI job, and resources.generated.ts. The Standards, Spec, and Correctness lenses ran as sequential passes.
Behavior or check Method / command Result Evidence source
Policy unit tests node --test .github/scripts/bundle-size-policy.test.mjs 10 of 10 pass Coordinator
Size at PR head pnpm build && pnpm size:check All entries within their limits. YouVersionProvider 61.52 / 62 KB, full barrel 179.15 / 180 KB Coordinator
Raise path on a locale-only diff Local simulation with a base branch at the old 54 / 175 KB limits Rewrote the limits to 62 / 180 KB and exited 1 Coordinator (temporary branches deleted)
Locale weight Brotli of the 19 locale JSON files combined About 28 KB (approximate, not bundle attribution) Coordinator
  • Limits: I didn't verify how the sync bot pushes its branch.
  • CI and bot review: all checks green at this head, including Bundle Size. The only bot comment is changeset-bot.
  • Event: COMMENT

Written by Code Reviewer bot on behalf of Cam.

Comment thread scripts/check-bundle-size.mjs Outdated
ru: { [defaultNS]: locale13 },
sr: { [defaultNS]: locale14 },
tr: { [defaultNS]: locale15 },
uk: { [defaultNS]: locale16 },

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.

suggestion: Consider lazy-loading non-English locales, so every consumer stops downloading all 19 languages and the size gate stops growing with each sync.

For Agents: the size gate is measuring real shipped bytes

Every locale is a static import here, so all of them land in the YouVersionProvider entry. Compressing the 19 locale JSON files together gives about 28 KB brotli (an approximation, not exact bundle attribution) of the 61.52 KB entry, and this sync moved that entry from about 54 KB to 61.5 KB. Loading non-default locales on demand (for example, dynamic import() per language via an i18next backend, or a resolver in syncSdkLanguage) would keep them out of the measured entry, which is a real exclusion, and shrink consumer bundles. Tradeoff: an async language switch and a build-shape change in the UI package. If that's too large for now, a lighter option is to bump the limits by hand in sync PRs. That's what this PR does at .size-limit.js anyway, and it would drop roughly 516 lines of new script and tests. ADR 0003 already treats these gates as accident guardrails, and any PR can edit .size-limit.js.

Written by Code Reviewer bot on behalf of Cam.

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.

@cameronapak I considered this and this is where I landed curious as to your thoughts.

We kept every language loaded up front because the SDK promises the right language on the first screen.

If Spanish is set, the server HTML and the first paint need to already be Spanish. Loading languages later would mean English first, then a swap, or a mismatch between server and client. App developers would have to wait on that, and we would own failed downloads and broken packages.

Smaller download for English-only apps was not worth breaking that.

Comment thread .github/workflows/ci.yml Outdated
Comment thread scripts/bundle-size-policy.mjs Outdated
A locale-only diff passes without rewriting .size-limit.js. The workflow owns the shallow base fetch; the size check only verifies that ref.
@cameronapak

Copy link
Copy Markdown
Collaborator

@camrun91 Thanks for the replies and the follow-up in platform-localization#92. Your reason for loading every language up front makes sense, so I'm dropping the lazy-loading suggestion.

Stepping back, I'd like to propose something simpler than either PR's automation.

Proposal: Remove the limit from ui / YouVersionProvider only and ui / full barrel in .size-limit.js, and drop the skip logic here and the auto-bump in #92.

Why:

  • These two limits don't protect anything right now. They move every time translations change, and nobody has promised a size budget. They only add friction.
  • The sizes stay visible. size-limit still measures an entry without a limit and prints it in the Bundle Size log. In size-limit 11.2.0, an entry can only fail when it has a limit.
  • Real mistakes still fail CI. ui / Separator only (the tree-shaking canary), core, hooks, and CSS keep their hard limits. Translations don't touch those numbers.
  • There's less to maintain. This deletes about 700 lines of scripts and tests across the two repos, and nobody has to bump numbers again.

What that looks like:

Trade-off: Nothing blocks a merge if the Provider bundle grows. If we later find that nobody looks at the numbers, we can add a PR size-change comment then.

What do you think?

Written by Code Reviewer bot on behalf of Cam.

@camrun91

Copy link
Copy Markdown
Collaborator

@camrun91 Thanks for the replies and the follow-up in platform-localization#92. Your reason for loading every language up front makes sense, so I'm dropping the lazy-loading suggestion.

Stepping back, I'd like to propose something simpler than either PR's automation.

Proposal: Remove the limit from ui / YouVersionProvider only and ui / full barrel in .size-limit.js, and drop the skip logic here and the auto-bump in #92.

Why:

  • These two limits don't protect anything right now. They move every time translations change, and nobody has promised a size budget. They only add friction.
  • The sizes stay visible. size-limit still measures an entry without a limit and prints it in the Bundle Size log. In size-limit 11.2.0, an entry can only fail when it has a limit.
  • Real mistakes still fail CI. ui / Separator only (the tree-shaking canary), core, hooks, and CSS keep their hard limits. Translations don't touch those numbers.
  • There's less to maintain. This deletes about 700 lines of scripts and tests across the two repos, and nobody has to bump numbers again.

What that looks like:

Trade-off: Nothing blocks a merge if the Provider bundle grows. If we later find that nobody looks at the numbers, we can add a PR size-change comment then.

What do you think?

Written by Code Reviewer bot on behalf of Cam.

This makes sense to me I will work on that now.

Locale syncs grow YouVersionProvider and the full barrel, so those entries stay printed without a ceiling. Separator, core, hooks, and CSS keep their budgets.
@camrun91
camrun91 requested a review from cameronapak October 20, 2026 17:57
cameronapak
cameronapak previously approved these changes Oct 20, 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.

Review

No Jira. Spec is the PR body.

Summary

Standards: 0 must-fix. Spec: 0 must-fix. Primary concern: none.

The current head implements the agreed simplification: keep translations and both size measurements, remove only the two UI limits, and restore plain pnpm size without localization-specific automation.

Review evidence
  • Scope: 7a5bbf0, compared with merge-base 3073603aa30b5340aa3b63d020df3e992f8f844a. Head rechecked before submission. Intent includes the author's acceptance of the simplification and synchronous locale loading.
  • Method: independent Standards, Spec, and Correctness source passes, reconciled against current code, tests, CI, and resolved discussion. No new handwritten helpers or dependencies need a reuse alternative.
Behavior or check Method / command Result Evidence source
Locale registration and preservation Read-only bun - assertions against pinned Git objects All 19 locale bundles parse, map correctly, preserve interpolation/markup contracts, and match the original translation commit byte-for-byte Coordinator
Budget and workflow scope Read-only configuration assertions and source diff Exactly two limits removed; eight other budgets, CI workflow, and package scripts unchanged Coordinator
Size measurement pnpm size Provider 61.52 kB and full barrel 179.15 kB printed without limits; all eight remaining budgets pass CI logs
Locale checks pnpm check:i18n and existing i18n tests Parity passes with 149 permitted warnings; all 56 i18n tests pass CI logs
Regression checks Build, lint, typecheck, tests, and tree-shaking Passed CI
  • Limits: full suites were inspected in CI, not rerun locally. No native-speaker translation review, rendered-locale visual check, or independent upstream-revision comparison. Missing translations retain English fallback.
  • Review context: earlier CI-policy concerns are resolved by the reverts. The lazy-loading suggestion was explicitly withdrawn; companion auto-bump work is separate.
  • Event: APPROVE.

Written by Code Reviewer bot on behalf of Cam.

Comment thread .size-limit.js
path: 'packages/ui/dist/index.js',
import: '{ YouVersionProvider }',
limit: '54 KB',
ignore: ['react', 'react-dom', 'react/jsx-runtime', '@tanstack/react-query'],

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.

praise: Keeping these measurements while removing only their limits preserves visibility without weakening the Separator canary or unrelated budgets.

For Agents: scoped simplification

The Provider and full-barrel entries still run in plain pnpm size. CI prints 61.52 kB and 179.15 kB without ceilings, while the other eight entries retain their existing hard limits. This achieves the accepted outcome without locale-specific skip or auto-bump machinery.

Written by Code Reviewer bot on behalf of Cam.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants