Repository navigation
Conversation
#62) - New typed HIGMessages contract in @bloxwap/hig-contracts (+ ./messages subpath) with English defaults exported per key, defaultMessages and resolveMessages. Components import only the defaults they render, so the Button bundle stays within budget (757/850 B gzip). - HIGProvider (web and native) takes a partial `messages`; nested providers inherit outer overrides, missing keys fall back to English. - Every built-in string now comes from messages: Close, Cancel, Dismiss (+ accessible name), busy suffix, required/stale/labelled value composition, landmarks, pagination, search, loading/empty states, native Menu/Select/Progress/BackButton, StatusIndicator states and recipe copy (TradeEntry, InstallCommand, ActivityList). - Per-component overrides: closeLabel (Dialog, AlertDialog, Popover, native Dialog, GestureSheet), busyLabel (Button; '' hides the suffix but keeps busy state), dismissLabel (Toast), label (native BackButton). - tests/localization-literals.test.ts scans packages/{react,native}/src with the TypeScript AST and fails on any new hard-coded user-facing literal; web and native tests render fr-FR, ko-KR and ar-EG (RTL). - Keys documented in docs/foundations/localization.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Refs #62
What
HIGMessagesin@bloxwap/hig-contracts(root export plus a new./messagessubpath). English defaults are exported one per key, alongsidedefaultMessagesandresolveMessages(). Function keys (pageOf(page,total),dismissNotice(message,dismiss),tradeHeading(asset),required(label),staleValue(value),labelledValue(label,value), …) receive host values, so translations can reorder them.HIGProvidertakemessages?: Partial<HIGMessages>. Nested providers inherit outer overrides; missing keys fall back to English. There is also auseMessages()hook.closeLabel: Dialog, AlertDialog, Popover, native Dialog, GestureSheet.busyLabel: Button.''hides the suffix but keepsaria-busy/accessibilityState.busy, for hosts that show a spinner.dismissLabel: Toast.label: native BackButton.npm run quality). A single defaults object pulled into every bundle measured 1331 B and broke the Button budget.docs/foundations/localization.md.Acceptance criteria
No hard-coded English without an override, enforced by a test.
tests/localization-literals.test.tswalks the TypeScript AST of every file inpackages/{react,native}/src. It fails on:aria-label,title,label,accessibilityLabel, …);Technical literals (class names, roles, layout values, key names, module ids) are allowed by context. A second test checks that the scanner catches
Close,aria-label='Close dialog',busy?'Working':…and`${n} results`. The scanner listed 96 literals before this change and lists 0 after it, including everything newly merged on main (Native fonts package, token font variables, and radius/type/motion/density roles (#64, #65, #66) #75, feat(native): token-role colours, Text font-scale cap/CJK tracking (#67) and Android slider set-progress (#71) #76, fix: shorter web buttons and pill-shaped inputs #80).Translated labels render on web and native, including RTL.
tests/localization.dom.test.tsxrenders fr-FR, ko-KR and ar-EG (dir=rtl). It checks that Close, Dismiss (visible text and accessible name) and the busy suffix are translated, and that no English remains. It also covers overrides, the empty busy label, nested providers and recipes.tests/native/localization.test.cjscovers the same matrix on React Native.tests/native/gesture-sheet.test.cjscovers the GestureSheet Close label (RTL) andcloseLabel.Monorepo native app drops its busy-suffix workaround. This PR adds what that needs (
<Button busy busyLabel=''>plus the host spinner, ormessages.busy). The monorepo change has to consume a candidate built from this merge, and the source PR bloxwap/monorepo#4540 is still open. I'll link the follow-up on Localize HIG built-in component strings (Close, Dismiss, busy suffix) #62.Proof (local, Linux, Node 22)
npm run check→ exit 0 (vitest 18 files / 104 tests; jest native 53 tests; lint + drift; typecheck)npm run examples:check && npm run quality && npm run smoke:ssr && npm run smoke:packed && npm run smoke:packed-boundaries && npm run smoke:packed-native→ exit 0NumberReadoutstale text now renders as onestaleValue(reading)run, e.g.— (stale). Before, it was a reading followed by a separate(stale)span.tests/data.dom.test.tsxis updated to match.Migration / rollback
Additive. English output is unchanged apart from the stale-readout DOM merge above. To roll back, revert this commit.
🤖 Generated with Claude Code