Repository navigation
feat: i18n per-component message groups (#325) - #333
Merged
Merged
Conversation
Contributor
|
Site preview: https://pr-333.codeatlas-ui.pages.dev |
mvilacad
force-pushed
the
feat/325-i18n-the-whole-message-catalog-ships
branch
from
October 17, 2026 15:12
9e363b5 to
b164aa7
Compare
mvilacad
force-pushed
the
feat/325-i18n-the-whole-message-catalog-ships
branch
from
October 17, 2026 15:17
b164aa7 to
ec43cba
Compare
mvilacad
marked this pull request as ready for review
October 17, 2026 15:17
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.
Closes #325
Design
i18n/groups/<name>.ts, eachdefineGroup("name", { en, "pt-BR" })(50 groups).pt-BRstays typed againsten(missing key = type error).useMessages(group, …)instead ofuseT();t().group.keycall sites are unchanged. Built-in locales travel inside each group, so SSR stays synchronous and a component pays for its own en + pt-BR strings only.catalog.ts(rune-free) holdsdefineGroup,getGroup(group, locale, override?)and theregisterLocaleregistry; resolution order, deep-merge overrides, region fallback (es-MX→es→en) and "registered locale replaces built-in" are unchanged.registerLocaleinvalidates the caches.all.tslists every group and backsMessages, publicgetMessages()anduseT()(full catalog, bundled only if imported).I18nProvider,setLocale,registerLocale,useLocaleunchanged.scripts/size-lib.ts: bundling helpers extracted fromsize-limit.tsso tests reuse them.Size (gzip, esbuild min, Svelte runtime included)
Before:
dist/i18n/pt-BR.js+en.jswere 13.1 kB minified (uncompressed) of Button's bundle.Test-first (
tests/i18n-split.test.ts)Before the change:
After:
10 pass 0 fail(i18n-split + i18n + i18n-register).Verification
bun run test:browser: 154 files, 1555 tests passbun run test:unit: 824 pass;test:ssr: 3 passbun run validate: ok (build, themes, token lint, biome, types package+site, unit, size)