You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1712f58
Browse filesBrowse the repository at this point in the historyBrowse files
docs(cli): the i18n guide keeps to what a caller can use
The shipped RTL and testing guide had gained the internal
useComponentTranslator pattern with relative imports into core source and
the contributor check command, none of which a caller of the package can
reach. The page now says what holds for a caller: components carry their own
strings, so an app bundles only the strings of the components it renders, and
useTranslator() resolves every @AstryX.* key; the contributor pattern stays in
CONTRIBUTING.md.
'Text direction (RTL), pseudo-locale testing, and contributor guidance for developers and translators.',
@@ -126,23 +122,22 @@ import pseudo from '@astryxdesign/core/locales/pseudo.generated.js';
126
122
},
127
123
{
128
124
type: 'prose',
129
-
text: "Astryx component authors read strings with `useComponentTranslator(<slice>)` rather than hardcoding user-facing text. The slice is the component's own namespace of the English catalog, so an app bundles only the strings of the components it renders.",
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()`:",
130
126
},
131
127
{
132
128
type: 'code',
133
129
lang: 'tsx',
134
130
label: 'Read an astryx string',
135
-
code: `import {useComponentTranslator} from '../i18n/useComponentTranslator';
136
-
import saveButtonMessages from '../i18n/generated-locales/en/saveButton.generated';
131
+
code: `import {useTranslator} from '@astryxdesign/core/i18n';
137
132
138
133
function SaveButton() {
139
-
const t = useComponentTranslator(saveButtonMessages);
text: "Astryx's own strings live in `packages/core/locales/en.json`, keyed `@astryx.<namespace>.<name>`. New user-facing strings must go through the translator; the `@astryx/no-hardcoded-i18n-string` ESLint rule enforces that, and `pnpm check:i18n-catalog` fails a key read outside the file's slice. `useTranslator()` from `@astryxdesign/core/i18n` is the consumer-facing hook and carries the whole catalog. See the AI contribution guide for the alias-and-resolve pattern used when adding new keys.",
140
+
text: "Astryx's own strings live in `packages/core/locales/en.json`, keyed `@astryx.<namespace>.<name>`. The contributing guide covers how a core component reads its strings, the `@astryx/no-hardcoded-i18n-string` ESLint rule and the alias-and-resolve pattern used when adding new keys.",
0 commit comments