Skip to content

Commit 305efa8

Browse files
committed
chore(i18n): declare the raw-context path's retirement
A value rendered straight into the public InternationalizationContext, without InternationalizationProvider, drove useLocale, useDirection, useCollator and every component's strings in the last release; with the hooks reading the provider's runtime context it reaches none of them. The changeset says so at the breaking tier, with the migration (mount the provider), and the context module's header says which readers each context reaches. The shipped i18n guide qualifies which apps the slicing saves bytes for, and carries its own docs changeset.
1 parent f47a870 commit 305efa8

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/cli': patch
3+
---
4+
5+
[docs] The i18n, RTL and testing guide keeps to what holds for a caller: `useTranslator()` resolves every `@astryx.*` key; how a core component reads its strings moves to the contributing guide.
6+
7+
@vjeux
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
2-
'@astryxdesign/core': patch
3-
'@astryxdesign/cli': patch
2+
'@astryxdesign/core': minor
43
---
54

6-
[chore] The i18n runtime can hand a component its own English strings. The English catalog is also emitted one namespace at a time, the resolver takes its English fallback per call, and an internal `useComponentTranslator(slice)` lets a core component render with its own slice; the components themselves move to it in a follow-up, so nothing changes for an app yet. `useTranslator()` and `InternationalizationContext` are unchanged and still resolve every `@astryx.*` key; an `InternationalizationProvider`'s `messages` and `overrides` still win; the slices themselves are not importable. One undocumented path moves: a value handed straight to `InternationalizationContext` without the provider no longer reaches `useLocale`, `useDirection` and `useCollator`, which read the provider's runtime context; mount `InternationalizationProvider`.
5+
[breaking] Rendering a value straight into `InternationalizationContext` no longer configures Astryx. Mount `InternationalizationProvider` instead; it takes the same `locale`, `messages` and `overrides`. The provider now writes an internal runtime context that `useLocale`, `useDirection`, `useCollator` and every core component read, so a value handed to the public context alone reaches none of them. Reading the public context is unchanged: `locale`, `direction`, `messages`, `overrides` and `translate`, which still resolves every `@astryx.*` key against the whole shipped English catalog, with or without a provider; `useTranslator()` is unchanged. Groundwork for components carrying only their own English strings: the English catalog is also emitted one namespace at a time, the resolver takes its English fallback per call, and an internal `useComponentTranslator(slice)` lets a core component render with its own slice; the components themselves move to it in a follow-up, so bundles do not change yet. The slices are not importable.
76

87
@vjeux

‎packages/cli/assets/docs/tree/i18n-rtl-and-testing.doc.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ import pseudo from '@astryxdesign/core/locales/pseudo.generated.js';
122122
},
123123
{
124124
type: 'prose',
125-
text: "Astryx components read their own strings from the English catalog rather than hardcoding them, so an app bundles only the strings of the components it renders. Your own code reads any `@astryx.*` key with `useTranslator()`:",
125+
text: "Astryx components read their strings from the English catalog rather than hardcoding them. Your own code reads any `@astryx.*` key with `useTranslator()`:",
126126
},
127127
{
128128
type: 'code',

‎packages/core/src/i18n/InternationalizationContext.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
* context a consumer reads. Its `translate` resolves every `@astryx.*` key,
1111
* falling back to the shipped English catalog, so this module carries that
1212
* catalog; the components inside this package read
13-
* TranslationRuntimeContext instead and carry only their own slices.
13+
* TranslationRuntimeContext instead and carry only their own slices. Both
14+
* are written by InternationalizationProvider, which is how an app
15+
* configures Astryx: a value rendered straight into this context reaches
16+
* consumers of this context and nothing inside the package.
1417
*
1518
* Separated from InternationalizationProvider.tsx so components can consume
1619
* the context without pulling in the full provider implementation.

0 commit comments

Comments
 (0)