Repository navigation
perf(i18n): load only the active message table at startup - #293
Merged
Merged
Conversation
Deploying document with
|
| Latest commit: |
7e1f50f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a1618276.document-7hm.pages.dev |
| Branch Preview URL: | https://perf-i18n-active-locale.document-7hm.pages.dev |
English stays in the bundle as the per-key fallback; the other six tables are chunks, and i18n.ts awaits the active one at top level so t() stays synchronous for every importer. The assistant awaits all tables because displayError matches error text saved in any language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chaxus
force-pushed
the
perf/i18n-active-locale
branch
from
October 24, 2026 11:49
e278651 to
7e1f50f
Compare
chaxus
enabled auto-merge (rebase)
October 24, 2026 11:49
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.
Follow-up to #292 (now merged); rebased onto
main. Baseline numbers are from #292's branch at39ae686f.Problem
packages/shared/src/i18n.tsimported all seven message tables statically. That came to 234 KB minified, about 73 KB gzip, in the sharedutils-*.jschunk that both/editorand/historyfetch before they run. Each visitor reads one of them.Change
import()per locale, andi18n.tsawaits the active one at module top level. Nothing that importst()runs before its table is in place, sot()stays synchronous and none of its callers change. If the chunk fails to load, the page starts in English.loadLocale(lang)is exported and shares in-flight loads.setLanguage(tests only) switches at once and fireslanguagechangeagain when a late table arrives.displayErrorin the assistant matches saved error text against every language, sopresentation.tsawaits all tables. It is not in the startup graph; it costs about 65 KB gzip, and only when the assistant opens. A fresh-context review of the diff found this.bin/offline-assets.mjsalready follows dynamic imports, and a stampedsw.jslists all six locale chunks.Measurements (static startup graph from
.vite/manifest.json, gzip -9)39ae686f)/editor/historyA non-English visitor also fetches one locale chunk, about 11 KB gzip.
Reverse validation
ja message table is in …/utils-*.js)./history?locale=deheading case (Received: "Saved documents").presentation.ts, the newagent-presentationcase fails (a Japanese error restored on a German page).Verification
pnpm run lint:ts,format:check, the full Vitest run (252 files / 6805 tests), and 43 E2E cases: startup payload, editor locales, history page, assistant history, assistant locale, assistant offline assets.Record:
docs/explorations/2026-10-24-active-locale-only.md.🤖 Generated with Claude Code