Skip to content

fix(core): many components carry only the English for their own strings - #9429

Merged
cixzhang merged 2 commits into
mainfrom
i18n-en-fallback-slices
Nov 2, 2026
Merged

cixzhang merged 2 commits into
mainfrom
i18n-en-fallback-slices

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Why (maintainer impact)

Every Core component that shows built-in text bundled the whole English catalog as its translation fallback. The resolver imported en.generated directly, so 60 of the 101 measured components each carried all 565 English strings (about 7 KB gzip), and adding a string to any component grew all 60.

This is the first of two changes. It adds the mechanism and moves most component families onto it. The follow-up moves Table, Chat, PowerSearch, CommandPalette and the date and time inputs, and then makes the wiring check strict (no Core module may use the public translator).

Intended invariant

Nothing anyone sees changes (architecture:internationalization INV3–INV5, INV15). Every key a component can resolve today resolves to the same English, in every locale's fallback path, with and without a provider, with translated catalogs and overrides. The public paths that can resolve any Astryx key keep the whole catalog: useTranslator and the InternationalizationContext export. @astryxdesign/core/locales/en.generated.js is still published unchanged.

What changed

  • scripts/generate-i18n-runtime.mjs (the step that already runs before install, build, test, Storybook, docsite and sandbox) also derives one English map per Core module that names catalog keys, into packages/core/src/i18n/generated-english/. The maps are ignored by version control, internal, and not exported. A key reference is any string literal that equals a catalog key, so keys kept in local maps count too. The watcher also regenerates when Core source changes.
  • The resolver reads registered English (i18n/englishFallback.ts) instead of importing the catalog. A moved module imports its own map and registers it at module scope, and uses the internal useComponentTranslator. Registration runs when the module loads, so a key resolves wherever the module that names it is loaded, including keys a helper looks up with a translator another module created.
  • The public useTranslator and the public context export (i18n/publicContext.ts) register the whole catalog through i18n/fullEnglishFallback.ts, the only module that imports it. Modules not moved yet keep using the public useTranslator, so they still carry the whole catalog and resolve exactly as before.
  • check:i18n-runtime (and the build and test setup) fails when a module names keys without either registering its own map or using the public useTranslator, registers its map but still imports the public useTranslator, imports another module's map, imports the whole catalog, or registers the whole catalog outside the public paths.
  • Moved here: 69 modules across every family except Table, Chat, PowerSearch (its config and value formatting moved), CommandPalette, DateInput, DateRangeInput, DateTimeInput and TimeInput.
  • Record: docs/architecture/internationalization.md names the per-module derived maps in the flow's shipped English fallback, in INV15 and in owning code, and adds the parity test and the import-cost check to verification.
  • Patch Changeset in plain words.

Size (import cost, gzip bytes)

Measured on built @astryxdesign/core with the per-pull-request size report's method (.github/scripts/lib/component-size.js, measureComponentImport), base and head on the same main commit.

Component Before After Change
Button 47,548 40,235 −7,313
TreeList 45,828 38,515 −7,313
SideNav 71,458 64,356 −7,102
Selector 83,276 76,356 −6,920
Pagination 92,265 85,575 −6,690
Avatar 40,112 32,906 −7,206
  • 52 of the 60 components that carried the whole catalog no longer do; median −7,180 B gzip each (range −6,561 to −7,376).
  • Until the follow-up lands, the 8 components that still bundle an unmoved module keep the whole catalog and also carry the maps of the moved modules they use: PowerSearch +1,384, DateRangeInput +1,228, DateTimeInput +1,159, DateInput +1,157, TimeInput +874, Markdown (renders Table) +719, Table +487, CommandPalette +443. No other component grew.

Risk

  • A module that names a key without reaching its English would show the raw key. The generator check fails the build and the test setup in that case, and the parity test covers every key every module names.
  • A key built at runtime (not a literal) would not be collected. Core has none: check:i18n-catalog reports its unverifiable references, and each is a local literal map (Chat status, Kbd) or PowerSearch operator labels, which still use the public translator.
  • Bundlers drop a module whose exports are unused together with its registration; that is safe because its keys are then never looked up. The public context export is its own binding so its registration is kept; the import-cost test checks this through the package entry.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • packages/core/src/i18n/__tests__/englishFallback.test.ts: resolution parity, every key each Core module names, in all 31 shipped runtime catalogs (with and without the provider catalog), resolved from the module's own map versus the whole catalog: identical. Also checks the generated maps hold exactly each module's keys with the catalog's English, and that every module is wired.
  • scripts/i18n-english-fallback.test.mjs: key collection, wiring failures on fixtures (including the still-public path), and the import-cost check on the built package: Button, TreeList, SideNav and Selector bundle under a quarter of the catalog keys; useTranslator and InternationalizationContext imported from the package entry keep all 565; useLocale keeps none.
  • useTranslator.test.tsx: the public hook and the public context resolve every shipped key to its English.
  • Focused i18n, PowerSearch and Table tests, generate-i18n-runtime tests, check:repo, Core typecheck, Core build. The complete change (this plus the follow-up) passed the full CI suite before the split.

CI impact

No workflow changes. The derived-sources step parses the Core modules that contain catalog keys (about 120 files) and writes 112 small maps; it adds well under a second to install, build and test setup. The new tests add about 4 s to the node project and a few seconds to the UI project.

Writing rubric results

R1 narration: none; the INV15 and flow edits state current behavior in the present tense.
R2 research: none in the record; size figures live in this description.
R3 evidence: verification cells name the tests and checks, not changes.
R4 rejected alternatives: none recorded.
R5 change references: none.
R6 open questions: none.

@vercel

vercel Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 2, 2026 4:04am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 2, 2026, 4:17 AM UTC

@cixzhang

cixzhang commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec a0365c7

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 2, 2026
@cixzhang cixzhang closed this Nov 2, 2026
@cixzhang cixzhang reopened this Nov 2, 2026
@cixzhang
cixzhang force-pushed the i18n-en-fallback-slices branch from a0365c7 to 2a5538d Compare November 2, 2026 02:17
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 2, 2026
@cixzhang
cixzhang force-pushed the i18n-en-fallback-slices branch from 2a5538d to 1c30ea0 Compare November 2, 2026 02:20
@cixzhang

cixzhang commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 1c30ea0

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 2, 2026
@cixzhang cixzhang closed this Nov 2, 2026
@cixzhang cixzhang reopened this Nov 2, 2026
@cixzhang

cixzhang commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec b38a096

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 25c5b07

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
lab/Comments 229.1 kB (+1.5 kB) · 2.5 kB CSS (0) — — · — · —
PowerSearch · Storybook 179.0 kB (+1.3 kB) · 20.4 kB CSS (0) 3,964 (+6) — · — · —
lab/MobileTokenizer 98.7 kB (+1.3 kB) · 880 B CSS (0) — — · — · —
136 more components
Component Size LoC Visual · A11y · RTL
lab/TransferListSelector 78.2 kB (+1.3 kB) · 1.9 kB CSS (0) — — · — · —
lab/MobilePowerSearch 163.6 kB (+1.3 kB) · 1.2 kB CSS (0) — — · — · —
DateRangeInput 75.2 kB (+1.2 kB) · 11.6 kB CSS (0) — — · — · —
DateTimeInput 117.8 kB (+1.2 kB) · 15.7 kB CSS (0) — — · — · —
DateInput 106.1 kB (+1.2 kB) · 15.2 kB CSS (0) — — · — · —
lab/CommentThread 223.9 kB (+950 B) · 2.4 kB CSS (0) — — · — · —
lab/CommentComposer 99.5 kB (+944 B) · 1.9 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 219.2 kB (+863 B) · 454 B CSS (0) — — · — · —
TimeInput 93.9 kB (+846 B) · 14.2 kB CSS (0) — — · — · —
ChatComposer 66.4 kB (+801 B) · 11.2 kB CSS (0) — — · — · —
lab/TransferList 72.0 kB (+792 B) · 1.7 kB CSS (0) — — · — · —
ChatComposerInput 61.0 kB (+790 B) · 10.4 kB CSS (0) — — · — · —
ChatComposerTokenElement 61.0 kB (+787 B) · 10.4 kB CSS (0) — — · — · —
Markdown · Storybook 150.8 kB (+760 B) · 18.3 kB CSS (0) 8,706 (+6) — · — · —
lab/EmojiPicker 67.9 kB (+753 B) · 722 B CSS (0) — — · — · —
lab/ListInput 79.8 kB (+622 B) · 1.6 kB CSS (0) — — · — · —
CommandPalette 55.3 kB (+529 B) · 12.2 kB CSS (0) — — · — · —
Table 90.1 kB (+491 B) · 16.0 kB CSS (0) — — · — · —
ChatLayout 53.0 kB (+424 B) · 10.3 kB CSS (0) — — · — · —
ChatDictationButton 50.4 kB (+360 B) · 9.8 kB CSS (0) — — · — · —
richtext/RichTextView 254.7 kB (+360 B) · 2.3 kB CSS (0) — — · — · —
ChatLayoutScrollButton 50.3 kB (+315 B) · 9.9 kB CSS (0) — — · — · —
CommandPaletteInput 34.0 kB (+260 B) · 8.5 kB CSS (0) — — · — · —
richtext/RichTextEditor 274.1 kB (+216 B) · 2.6 kB CSS (0) — — · — · —
ChatSendButton 49.5 kB (+212 B) · 9.5 kB CSS (0) — — · — · —
ChatMessageList 30.1 kB (+206 B) · 7.9 kB CSS (0) — — · — · —
lab/DiffViewer 48.0 kB (+183 B) · 2.1 kB CSS (0) — — · — · —
ChatToolCalls 33.1 kB (+163 B) · 9.3 kB CSS (0) — — · — · —
TableSelectionToolbar 56.3 kB (+131 B) · 11.5 kB CSS (0) — — · — · —
CommandPaletteFooter 24.0 kB (+113 B) · 3.7 kB CSS (0) — — · — · —
lab/ChatTypingIndicator 24.3 kB (+10 B) · 612 B CSS (0) — — · — · —
AvatarStatusDot 7.2 kB (0) · 3.6 kB CSS (0) — — · — · —
ChatComposerDrawer 24.6 kB (0) · 4.7 kB CSS (0) — — · — · —
Dialog 16.4 kB (0) · 6.6 kB CSS (0) — — · — · —
Drawer 34.1 kB (0) · 8.2 kB CSS (0) — — · — · —
DropdownMenuCheckboxItem 18.2 kB (0) · 5.9 kB CSS (0) — — · — · —
DropdownMenuDivider 5.2 kB (0) · 548 B CSS (0) — — · — · —
DropdownMenuGroup 6.2 kB (0) · 3.4 kB CSS (0) — — · — · —
DropdownMenuItem 17.4 kB (0) · 5.5 kB CSS (0) — — · — · —
DropdownMenuRadioGroup 6.1 kB (0) · 3.3 kB CSS (0) — — · — · —
DropdownMenuRadioItem 18.2 kB (0) · 5.9 kB CSS (0) — — · — · —
LinkProvider 3.5 kB (0) · 20 B CSS (0) — — · — · —
MetadataListItem 6.6 kB (0) · 3.5 kB CSS (0) — — · — · —
SelectorOption 16.5 kB (0) · 5.4 kB CSS (0) — — · — · —
SideNavSection 6.6 kB (0) · 3.7 kB CSS (0) — — · — · —
Tab 11.2 kB (0) · 4.2 kB CSS (0) — — · — · —
TopNavItem 10.6 kB (0) · 4.0 kB CSS (0) — — · — · —
TopNavMegaMenuFeaturedCard 6.9 kB (0) · 3.6 kB CSS (0) — — · — · —
TopNavMegaMenuItem 10.6 kB (0) · 4.2 kB CSS (0) — — · — · —
TypeaheadItem 6.3 kB (0) · 3.6 kB CSS (0) — — · — · —
ChatMessage 23.7 kB (−9 B) · 3.7 kB CSS (0) — — · — · —
CommandPaletteList 23.0 kB (−15 B) · 3.4 kB CSS (0) — — · — · —
ChatMessageMetadata 26.6 kB (−44 B) · 4.1 kB CSS (0) — — · — · —
TopNav 49.3 kB (−6.5 kB) · 10.7 kB CSS (0) — — · — · —
Pagination · Storybook 83.8 kB (−6.5 kB) · 15.9 kB CSS (0) 651 (+5) — · — · —
MultiSelector · Storybook 70.6 kB (−6.7 kB) · 15.1 kB CSS (0) 2,714 (+5) — · — · —
FileInput · Storybook 51.6 kB (−6.7 kB) · 10.7 kB CSS (0) 779 (+5) — · — · —
Selector 74.7 kB (−6.8 kB) · 15.5 kB CSS (0) — — · — · —
NumberInput · Storybook 52.8 kB (−6.8 kB) · 11.1 kB CSS (0) 1,150 (+6) — · — · —
Tokenizer · Storybook 67.5 kB (−6.9 kB) · 17.0 kB CSS (0) 1,977 (+10) — · — · —
TextArea · Storybook 45.0 kB (−6.9 kB) · 9.8 kB CSS (0) 480 (+5) — · — · —
Citation · Storybook 19.9 kB (−6.9 kB) · 4.4 kB CSS (0) 234 (+5) — · — · —
lab/ChatReactionBar 63.0 kB (−6.9 kB) · 1.1 kB CSS (0) — — · — · —
Typeahead 60.3 kB (−6.9 kB) · 11.7 kB CSS (0) — — · — · —
TextInput · Storybook 50.5 kB (−6.9 kB) · 10.9 kB CSS (0) 396 (+5) — · — · —
lab/ChatEmojiPicker 62.4 kB (−6.9 kB) · 773 B CSS (0) — — · — · —
Calendar · Storybook 52.0 kB (−6.9 kB) · 10.3 kB CSS (0) 1,646 (+6) — · — · —
BaseTypeahead 52.6 kB (−6.9 kB) · 10.2 kB CSS (0) — — · — · —
ComplexSelector · Storybook 53.3 kB (−6.9 kB) · 11.1 kB CSS (0) 685 (+5) — · — · —
MoreMenu · Storybook 70.8 kB (−6.9 kB) · 15.4 kB CSS (0) 92 (+5) — · — · —
TopNavHeading 55.1 kB (−7.0 kB) · 10.4 kB CSS (0) — — · — · —
ContextMenu · Storybook 72.7 kB (−7.0 kB) · 15.3 kB CSS (0) 693 (+5) — · — · —
Kbd · Storybook 16.7 kB (−7.0 kB) · 3.6 kB CSS (0) 155 (+8) — · — · —
lab/CommentPin 44.3 kB (−7.0 kB) · 1.2 kB CSS (0) — — · — · —
CheckboxListItem 51.4 kB (−7.0 kB) · 11.0 kB CSS (0) — — · — · —
Switch · Storybook 45.1 kB (−7.0 kB) · 9.7 kB CSS (0) 578 (+5) — · — · —
CheckboxInput · Storybook 46.7 kB (−7.0 kB) · 9.7 kB CSS (0) 361 (+5) — · — · —
TableHeaderCell 73.6 kB (−7.0 kB) · 15.5 kB CSS (0) — — · — · —
SegmentedControl 34.0 kB (−7.0 kB) · 6.5 kB CSS (0) — — · — · —
SideNavHeading 55.6 kB (−7.0 kB) · 10.5 kB CSS (0) — — · — · —
Toolbar 34.5 kB (−7.0 kB) · 7.9 kB CSS (0) — — · — · —
Step 27.8 kB (−7.0 kB) · 5.6 kB CSS (0) — — · — · —
ListItem 50.8 kB (−7.0 kB) · 11.0 kB CSS (0) — — · — · —
SideNav 63.1 kB (−7.0 kB) · 10.9 kB CSS (0) — — · — · —
TableCell 73.9 kB (−7.0 kB) · 15.8 kB CSS (0) — — · — · —
TabList 35.2 kB (−7.0 kB) · 7.5 kB CSS (0) — — · — · —
Token · Storybook 25.1 kB (−7.0 kB) · 4.8 kB CSS (0) 548 (+5) — · — · —
Slider · Storybook 44.2 kB (−7.0 kB) · 8.9 kB CSS (0) 1,056 (+5) — · — · —
DropdownMenu 70.5 kB (−7.0 kB) · 15.4 kB CSS (0) — — · — · —
Outline · Storybook 24.2 kB (−7.0 kB) · 4.2 kB CSS (0) 1,233 (+5) — · — · —
Carousel · Storybook 47.1 kB (−7.0 kB) · 10.5 kB CSS (0) 493 (+5) — · — · —
ContextMenuItem 50.2 kB (−7.0 kB) · 9.9 kB CSS (0) — — · — · —
Banner · Storybook 44.4 kB (−7.0 kB) · 10.3 kB CSS (0) 495 (+5) — · — · —
AppShell · Storybook 65.5 kB (−7.0 kB) · 12.0 kB CSS (0) 1,016 (+5) — · — · —
TopNavMegaMenu 51.2 kB (−7.0 kB) · 11.2 kB CSS (0) — — · — · —
AvatarGroup 35.0 kB (−7.0 kB) · 6.6 kB CSS (0) — — · — · —
TopNavMenu 55.0 kB (−7.0 kB) · 10.5 kB CSS (0) — — · — · —
Lightbox · Storybook 48.1 kB (−7.0 kB) · 10.1 kB CSS (0) 815 (+5) — · — · —
Thumbnail · Storybook 47.3 kB (−7.0 kB) · 11.3 kB CSS (0) 360 (+5) — · — · —
charts/ChartLegend 50.2 kB (−7.0 kB) · 20 B CSS (0) — — · — · —
MobileNavToggle 42.8 kB (−7.0 kB) · 9.7 kB CSS (0) — — · — · —
RadioListItem 49.3 kB (−7.0 kB) · 10.1 kB CSS (0) — — · — · —
Popover · Storybook 46.3 kB (−7.0 kB) · 12.4 kB CSS (0) 997 (+10) — · — · —
BreadcrumbItem 64.7 kB (−7.1 kB) · 11.4 kB CSS (0) — — · — · —
DropdownMenuSubMenu 55.7 kB (−7.1 kB) · 9.9 kB CSS (0) — — · — · —
SideNavItem 51.7 kB (−7.1 kB) · 10.4 kB CSS (0) — — · — · —
ResizeHandle 18.7 kB (−7.1 kB) · 4.0 kB CSS (0) — — · — · —
AvatarGroupOverflow 36.1 kB (−7.1 kB) · 6.5 kB CSS (0) — — · — · —
MetadataList 16.7 kB (−7.1 kB) · 3.8 kB CSS (0) — — · — · —
Avatar 32.2 kB (−7.1 kB) · 6.5 kB CSS (0) — — · — · —
Breadcrumbs 16.0 kB (−7.1 kB) · 3.4 kB CSS (0) — — · — · —
CodeBlock · Storybook 56.9 kB (−7.1 kB) · 11.1 kB CSS (0) 2,184 (+5) — · — · —
MobileNav 47.8 kB (−7.1 kB) · 10.4 kB CSS (0) — — · — · —
lab/TourStep 51.6 kB (−7.1 kB) · 590 B CSS (0) — — · — · —
FieldLabel 33.1 kB (−7.1 kB) · 5.9 kB CSS (0) — — · — · —
Toast · Storybook 56.5 kB (−7.1 kB) · 10.1 kB CSS (0) 1,513 (+10) — · — · —
AlertDialog · Storybook 53.5 kB (−7.1 kB) · 12.7 kB CSS (0) 188 (+5) — · — · —
DrawerHeader 45.5 kB (−7.1 kB) · 11.6 kB CSS (0) — — · — · —
lab/Schedule 57.6 kB (−7.1 kB) · 3.9 kB CSS (0) — — · — · —
CheckboxList 41.2 kB (−7.1 kB) · 8.6 kB CSS (0) — — · — · —
RadioList 40.8 kB (−7.1 kB) · 8.3 kB CSS (0) — — · — · —
DialogHeader 45.4 kB (−7.1 kB) · 10.2 kB CSS (0) — — · — · —
TabMenu 52.2 kB (−7.1 kB) · 10.4 kB CSS (0) — — · — · —
Stepper 44.0 kB (−7.1 kB) · 9.9 kB CSS (0) — — · — · —
Field 39.4 kB (−7.1 kB) · 8.3 kB CSS (0) — — · — · —
InputGroup 40.0 kB (−7.1 kB) · 8.4 kB CSS (0) — — · — · —
LayerProvider 60.6 kB (−7.1 kB) · 10.5 kB CSS (0) — — · — · —
SideNavCollapseButton 43.2 kB (−7.1 kB) · 9.8 kB CSS (0) — — · — · —
Timestamp · Storybook 21.3 kB (−7.1 kB) · 9.9 kB CSS (0) 686 (+10) — · — · —
TreeList · Storybook 37.8 kB (−7.2 kB) · 5.0 kB CSS (0) 1,152 (+5) — · — · —
Link 40.0 kB (−7.2 kB) · 7.9 kB CSS (0) — — · — · —
ToggleButton 40.3 kB (−7.2 kB) · 9.6 kB CSS (0) — — · — · —
Button · Storybook 39.4 kB (−7.2 kB) · 9.5 kB CSS (0) 590 (+5) — · — · —
charts/Chart 60.7 kB (−7.2 kB) · 20 B CSS (0) — — · — · —
IconButton 39.5 kB (−7.2 kB) · 9.5 kB CSS (0) — — · — · —
Spinner · Storybook 18.5 kB (−7.2 kB) · 6.7 kB CSS (0) 301 (+5) — · — · —

Package size: @astryxdesign/core 5.83 MB packed (+59.4 kB); no new dependencies.

API changes: none in this pull request

Committed API report behind this build: core 4 rows; run pnpm api:report.

Wide change (51 components): add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this: every resolved string stays the same and most component imports drop by about 7 KB gzip, but two things need changing before approval. The changeset and title say every component that shows built-in text now carries only its own English, while PowerSearch keeps the whole catalog and grows by about 2 KB gzip, so please narrow that wording. At 2,282 authored lines, please also split the change (for example the registry, resolver, generator and check first, then component families) or explain why the module edits have to land together.

[Automated review]

'@astryxdesign/core': patch
---

[fix] Components that show built-in text are smaller. Each one now carries only the English for its own strings instead of every Core string, so a component such as Button loads about 7 KB less (gzip) and a new string elsewhere in Core no longer makes it bigger. Nothing you see changes: every built-in string still shows the same English, translations and overrides resolve as before, and `useTranslator`, `InternationalizationContext` and `@astryxdesign/core/locales/en.generated.js` still reach every Astryx string.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This says every component that shows built-in text is smaller and carries only its own English, but PowerSearch still registers the whole catalog through resolveOperatorLabel.ts and its import grows by about 2 KB gzip. Suggest: "Most components that show built-in text are smaller… PowerSearch still carries every Core string, because a custom operator's i18nKey can name any Astryx key, and grows by about 2 KB."

@cixzhang
cixzhang force-pushed the i18n-en-fallback-slices branch from b38a096 to bc30e6f Compare November 2, 2026 02:57
@cixzhang cixzhang changed the title fix(core): each component carries only the English for its own strings fix(core): most components carry only the English for their own strings Nov 2, 2026
@cixzhang

cixzhang commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Both addressed at bc30e6f:

  • Wording: the Changeset and title now say most components; PowerSearch keeps every Core string (a custom operator's i18nKey can name any Astryx key) and grows by about 2 KB.
  • Size: kept as one change, with the reason now in the description under "Why one pull request". About 1,060 lines are the mechanism, tests and record; the other ~1,220 are the same four-line wiring in 114 modules. Once the resolver stops importing the whole catalog, every module that names keys must register its map in the same change, and the generator check fails the build otherwise, so a per-family split cannot go green. Splitting machinery first would add two no-op pull requests and an intermediate state where components carry both their map and the whole catalog.

@cixzhang cixzhang closed this Nov 2, 2026
@cixzhang cixzhang reopened this Nov 2, 2026
@cixzhang

cixzhang commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec bc30e6f

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The changeset and title now match the measured sizes, and every component bundle still carries the English for each key it uses, so the one remaining item is scope. At 2,282 authored lines this is over the repository's 2,000-line review threshold, and the reason given for one pull request shows only that a split needs a staged wiring check: because the public useTranslator already registers the whole catalog, the registry, resolver, generator, record and tests can land first with the check also accepting modules that still call it, followed by component families and a last change that restores today's rule. Please split along those lines, or explain why that staged check cannot work.

[Automated review]

A component that shows built-in text bundled the whole English catalog as its
fallback. The resolver now reads English registered by the modules that name
the keys: each Core module derives a map of exactly its keys (generated before
install, build, and test; ignored by version control) and registers it. The
public useTranslator and the public context export keep the whole catalog.
Table, Chat, PowerSearch, CommandPalette and the date and time inputs still use
the public translator for now.
@cixzhang cixzhang changed the title fix(core): most components carry only the English for their own strings fix(core): many components carry only the English for their own strings Nov 2, 2026
@cixzhang
cixzhang force-pushed the i18n-en-fallback-slices branch from bc30e6f to 2ea1202 Compare November 2, 2026 03:37
@cixzhang

cixzhang commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Split as suggested, at 2ea1202: this pull request now holds the registry, resolver, generator, record lines and tests, plus 69 component modules (1,801 changed lines). The wiring check accepts a module that still resolves its keys through the public useTranslator, and rejects one that registers its own map while still importing it. Table, Chat, PowerSearch, CommandPalette and the date and time inputs move in a follow-up that also makes the check strict again. The Changeset and description name the components that keep the whole catalog until then.

@cixzhang cixzhang closed this Nov 2, 2026
@cixzhang cixzhang reopened this Nov 2, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 2, 2026
@cixzhang

cixzhang commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 2ea1202

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 2, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for splitting this: every built-in string still resolves to the same English, 52 component imports drop about 7 KB gzip each, and the change is now well inside the size limit, but two documentation fixes are needed before approval.

  • docs/architecture/internationalization.md (INV15, the owning-code entry and the INV15 verification row) says every Core module that names catalog keys registers its own map, while Table, Chat, PowerSearch, CommandPalette and the date and time inputs still resolve through the public useTranslator; record that as a known conformance gap, as INV9 does for currency(), until the follow-up lands.
  • The changeset lists the components that still carry every Core string but leaves out Markdown, which renders Table and grows by about 750 B gzip.

After the new commit, an engineering owner re-approves the record with /approve-spec <full head SHA>.

[Automated review]

Comment on lines +316 to +319
other metadata. The built-in English fallback reads English derived from the
generated English module: each Core module that names catalog keys registers
a derived map of exactly those keys, and public paths that resolve any Astryx
key register the whole module. Neither path, shape, nor export of the rich

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

At this head 43 of the 112 key-naming Core modules (Table, Chat, PowerSearch, CommandPalette and the date and time inputs) register no map and resolve through the public useTranslator, which findWiringProblems accepts for now. Could this sentence, the owning-code entry and the INV15 verification row record that as a known conformance gap (as INV9 does for the charts currency() helper), to be removed when the follow-up makes the check strict?

'@astryxdesign/core': patch
---

[fix] Many components that show built-in text are smaller. Each one now carries only the English for its own strings instead of every Core string, so a component such as Button loads about 7 KB less (gzip) and a new string elsewhere in Core no longer makes it bigger. Table, Chat, PowerSearch, CommandPalette and the date and time inputs still carry every Core string for now. Nothing you see changes: every built-in string still shows the same English, translations and overrides resolve as before, and `useTranslator`, `InternationalizationContext` and `@astryxdesign/core/locales/en.generated.js` still reach every Astryx string.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Markdown also still carries every Core string, because it renders Table: its import keeps all 565 strings and grows by about 750 B gzip. Suggest adding it here, e.g. "Table (and Markdown, which renders it), Chat, PowerSearch, CommandPalette and the date and time inputs still carry every Core string for now."

@cixzhang cixzhang closed this Nov 2, 2026
@cixzhang cixzhang reopened this Nov 2, 2026
@cixzhang

cixzhang commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 25c5b07

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approval recommended: every built-in string still resolves to the same English, 57 component imports drop about 7 KB gzip each, and the public useTranslator and InternationalizationContext keep the whole catalog. The record now names the modules still on the public translator as a known gap, and the changeset lists exactly the components that keep every string. One optional wording tweak: the INV15 gap sentence counts PowerSearch's value-formatting and config modules among those with no map of their own, though both register theirs.

[Automated review]

This branch was successfully deployed

1 active deployment
Preview — 25c5b07f Deployed Nov 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant