Repository navigation
docs(core): define the internationalization contract - #6048
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
b16fd6c to
8b4f2b9
Compare
PR Analysis Report
|
|
/approve-spec 8b4f2b9 |
cixzhang
left a comment
There was a problem hiding this comment.
Thanks for documenting the shared internationalization architecture and the provider-specific contract together. Approved at exact head 8b4f2b9853fae7dafb3bd4d72877301bfa489366.
|
AI review status for this pull request.
|
8b4f2b9 to
77b995b
Compare
8b74366 to
1884b30
Compare
d2abcb7 to
64cffde
Compare
64cffde to
a205918
Compare
0a2ca4c to
d43af9b
Compare
There was a problem hiding this comment.
Thanks for consolidating the internationalization contract — the released fallback, direction, and provider-update behavior is well captured, and the new test now proves rerenders on messages, overrides, and dir changes plus nested-provider replacement.
Approval needs a maintainer decision first. These records are proposed as current authority, but the owner approval on file is for an earlier draft head and the exact-head spec-owner approval is still pending. A maintainer needs to approve these exact records at the current head, including whether the runtime-catalog contract should become current before its implementation lands.
One actionable correction is tied to that decision: the records currently present generated runtime catalogs, the generated locale export, and string-map catalog input as shipped and test-covered, but at this head there is no generator, generated export, runtime-catalog type, or resolver support for that shape, and the cited runtime-catalog tests do not exist here. Please either land that implementation first or correct those claims and their verification map to match shipped behavior — or, if spec-first recording is the maintainer's intent, make the proposed (not shipped) state explicit.
The authored size, checks, and released-behavior coverage are otherwise in good shape.
[Automated review]
d43af9b to
d493805
Compare
There was a problem hiding this comment.
Thanks for the thorough internationalization contract — the fallback, runtime-catalog and direction behavior it records matches the shipped provider, and the new tests pass. Approval waits on a maintainer decision: both records add normative requirements that no current spec states — the architecture invariants with their review routes, and the provider's FR, ORD, AR, PR and DEC-1 rules — so a maintainer needs to approve them as the governing spec at this head or identify the spec that should govern instead. Separately, please fix these before approval:
- INV9 and the System behavior row say optional-locale pure helpers default to English, but
currency()in@astryxdesign/chartsfollows the host locale whenlocaleis omitted, so record that exception or settle a separate change to the helper. - The released-surface list in the System model leaves out the exported
Locale,MessageEntryandOverridestypes. - FR9's verification row lists a mixed rich-plus-string-map state that no test exercises.
[Automated review]
| - **INV9 — Pure helpers have deterministic compatibility defaults.** A public pure | ||
| formatter that predates provider threading may keep an optional locale for | ||
| compatibility, but its omitted value resolves deterministically to English. | ||
| Astryx-owned call sites pass the provider locale explicitly. New pure helpers | ||
| require an explicit locale unless a current contract records another default. |
There was a problem hiding this comment.
INV9 (and the System behavior row on line 82) says an omitted locale resolves deterministically to English, but the shipped currency(symbol, locale?) in @astryxdesign/charts passes an omitted locale straight to Intl.NumberFormat and toLocaleString: currency('€')(999.5) gives €999,5 on a de-DE host and €999.5 on an en-US host. Please name that exception here, or settle changing currency() as its own compatibility change.
| `@astryxdesign/core/i18n` is the canonical public entry point. The released | ||
| surface consists of `InternationalizationProvider`, `InternationalizationContext`, | ||
| their public value/prop types, `useTranslator`, `TranslatorFn`, `useLocale`, | ||
| `useCollator`, `useDirection`, `getLocaleDirection`, the catalog types `Catalog`, | ||
| `RuntimeCatalog`, `MessagesByLocale`, and `ProviderMessagesByLocale`, and the | ||
| `Translator` interface. Shipped catalogs are published under |
There was a problem hiding this comment.
This reads as the complete released surface, but @astryxdesign/core/i18n also exports Locale, MessageEntry and Overrides (the type of the released overrides prop). Please add them, or make the list non-exhaustive, so INV2's compatibility protection clearly covers them.
| | FR6 | `useTranslator.test.tsx`, `useLocale.test.tsx`, `useDirection.test.tsx` | no provider | Host locale or missing English output fails | `audit:InternationalizationProvider/behavior` | | ||
| | FR7, AR1, AR2 | component translation tests and hardcoded-string lint | visible text, aria label, announcement, missing translation | Non-string output or untranslated owned text fails tests/lint | `audit:InternationalizationProvider/accessibility` | | ||
| | FR8 | `InternationalizationProvider.test.tsx` | parent plus child provider | Parent messages, overrides, or direction leaking into the child fails | `audit:InternationalizationProvider/behavior` | | ||
| | FR9, ORD1a | `useTranslator.test.tsx`, `resolve.test.ts` runtime-catalog cases | generated string map, rich catalog, mixed | A rejected string map, a string-map entry on the context, or divergent output between shapes fails | `audit:InternationalizationProvider/behavior` | |
There was a problem hiding this comment.
This row lists a mixed state, but no case in useTranslator.test.tsx or resolve.test.ts passes rich and string-map catalogs in one messages value. Please add one mixed-shape case, or drop mixed from the row.
…ypes Name the known charts currency() host-default gap under INV9 without treating it as a recorded default, list the exported Locale, MessageEntry, and Overrides types in the released surface, and cover a messages value that mixes rich and runtime catalogs.
d48cd04 to
4ba4dec
Compare
|
/approve-spec 4ba4dec |
Stack
Intent
Define Astryx's intended translation, locale, direction, and catalog-delivery boundaries without changing the runtime. Shared helpers own locale-sensitive operations and Gregorian default date behavior. Known consumer inconsistencies remain follow-up conformance work, not exceptions to the contract.
Prerequisite
The owner-validator fix changes the checker's effective approver set from historical schema lists to the current ENGOWNERS list, matching the existing repository approval rules; DESIGNOWNERS remains additive only for design/theme. Membership is unchanged, the immutable schema lists remain historical and ignored by this check, and no approval is inferred. This isolated tooling prerequisite landed first in #7538.
Authority
Both records are promoted to
authority: currentwithapproved_by: nynexman4464andapproved_at: 2026-10-15, on the owner's approval of the reviewed claims. The exact-head/approve-speccommand on this pull request records that decision for the final head; a later commit invalidates it.Approval covers the reviewed contract, not conformance of every existing caller. Known implementation gaps stay explicit and uncontracted here:
currency()helper follows the host locale when its locale is omitted (recorded under INV9 as a conformance gap, not a default; a separate compatibility change);Existing authority searched
architecture:internationalization,component:InternationalizationProvider; the existing docs(core): define the internationalization contract #6048 draft is reused rather than replaced.architecture:knowledge-contractsINV2/INV10/INV13/INV14/INV19/INV20 and its global-review overlay; public API ownership and compatibility guidance; the repository approval rules indocs/README.mdand ENGOWNERS.packages/core/src/i18n/,packages/core/locales/,scripts/generate-i18n-runtime.mjs,packages/build/src/vite.ts, the i18n lint rules;InternationalizationProvider,InternationalizationContext,useTranslator,RuntimeCatalog,ProviderMessagesByLocale, and the resolver.Authority and ownership
The canonical owners remain
architecture:internationalizationandcomponent:InternationalizationProvider.nynexman4464is listed first as the responsible maintainer, withcixzhangretained as co-owner. Repository ENGOWNER eligibility, rather than the order of this descriptive list, governs approval.Cross-cutting review
The existing
review-applicability:v1overlay routes selected shared claims by semantic trigger. Accessibility reviews receive string ownership/catalog-backed text/output rules; behavior reviews additionally receive provider-locale, fallback, formatter-helper, and Gregorian rules. Layout/runtime changes receive the relevant DOM-direction claims. Catalog-generation and provider implementation details are not automatically applied to every component.Component/module/family records keep their local content semantics, public concepts, states, and evidence. They need not repeat global rules or add a backlink merely to receive them. The provider record remains the local provider contract, not a second universal component spec. The routes become authoritative only once these records land as current.
No schema, runtime, or new Changeset is added for this routing metadata. The existing Changeset is for the shipped provider-doc anatomy addition, not the specs.
Changes
currency()host-default gap under INV9, list the exportedLocale,MessageEntry, andOverridestypes in the released surface, and add a provider test for onemessagesvalue mixing rich and runtime catalogs (addresses the latest automated review; no implementation change).Evidence
pnpm check:repopasses.currency()is not modified.git diff --checkpass.Writing rubric results
R1 narration: removed the RFC-origin narrative from the architecture purpose; standing text describes the system. Promotion removed draft-readiness wording rather than narrating the approval.
R2 research: no surveys, benchmarks, or options research in the records.
R3 evidence: replaced the provider fallback row's RFC citation with the current resolver and focused tests.
R4 rejected alternatives: narrowed the parallel-runtime rejection to one compact statement of the ownership boundary.
R5 change references: removed RFC and PR references from the records; implementation and prior review history remain here.
R6 open questions: retained unresolved supplied-English fallback, malformed-locale, adapter, and server-runtime boundaries without changing their outcomes.