@owlmeans/client-i18n 0.1.16-rc.0 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -4
- package/agent-meta/manifest.json +4 -11
- package/agent-meta/skills/client-i18n/SKILL.md +15 -2
- package/build/context.d.ts.map +1 -1
- package/build/utils/instance.d.ts.map +1 -1
- package/build/utils/instance.js +4 -1
- package/build/utils/instance.js.map +1 -1
- package/package.json +7 -7
- package/src/utils/instance.ts +4 -1
- package/agent-meta/instructions/client-i18n.instructions.md +0 -54
package/README.md
CHANGED
|
@@ -63,10 +63,9 @@ Returns a `t()` function for shared/common translations.
|
|
|
63
63
|
<!-- owlmeans:agent-guidance:start -->
|
|
64
64
|
## Agent guidance
|
|
65
65
|
|
|
66
|
-
This package ships embedded
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
(`.claude/skills/` and `.github/instructions/`):
|
|
66
|
+
This package ships embedded agent skills under `agent-meta/`. After installing your
|
|
67
|
+
`@owlmeans/*` packages, run the OwlMeans agent-skills installer to place them into
|
|
68
|
+
your project's skill store (`.agents/skills/`):
|
|
70
69
|
|
|
71
70
|
```sh
|
|
72
71
|
npx @owlmeans/agent-skills
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion":
|
|
2
|
+
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/client-i18n",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"generatedAt": "2026-08-
|
|
4
|
+
"version": "0.1.17",
|
|
5
|
+
"generatedAt": "2026-08-15T13:01:19.935Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -10,14 +10,7 @@
|
|
|
10
10
|
"name": "client-i18n",
|
|
11
11
|
"category": "package-specific",
|
|
12
12
|
"file": "skills/client-i18n/SKILL.md",
|
|
13
|
-
"canonicalPath": ".
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"kind": "instruction",
|
|
17
|
-
"name": "client-i18n",
|
|
18
|
-
"category": "package-specific",
|
|
19
|
-
"file": "instructions/client-i18n.instructions.md",
|
|
20
|
-
"canonicalPath": ".github/instructions/client-i18n.instructions.md"
|
|
13
|
+
"canonicalPath": ".agents/skills/client-i18n/SKILL.md"
|
|
21
14
|
}
|
|
22
15
|
]
|
|
23
16
|
}
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/client-i18n
|
|
9
9
|
|
|
10
10
|
**Layer:** Client (React)
|
|
11
|
-
**Install:** `"@owlmeans/client-i18n": "^0.1.
|
|
11
|
+
**Install:** `"@owlmeans/client-i18n": "^0.1.17"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
## Purpose
|
|
14
14
|
|
|
@@ -106,6 +106,19 @@ import myErrors from './i18n/en.json' // with { type: 'json' }
|
|
|
106
106
|
addI18nApp('en', 'errors', myErrors)
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
+
## Resource JSON format
|
|
110
|
+
|
|
111
|
+
The shared instance runs i18next's **v4** JSON format — `compatibilityJSON` is not set and must
|
|
112
|
+
not be, because i18next >= 26 accepts only `'v4'` and rejects `'v3'` at compile time. Plurals
|
|
113
|
+
therefore use Intl.PluralRules suffixes (`key_one` / `key_other`), never the v3 `key_plural` /
|
|
114
|
+
`key_0` / `key_1` forms. No resource in the ecosystem carries a plural-suffixed key today;
|
|
115
|
+
`{{count}}` in a message is plain interpolation and is unaffected.
|
|
116
|
+
|
|
117
|
+
Keep `i18next` and `react-i18next` in step — `react-i18next@17` requires `i18next >= 26.2.0`, and
|
|
118
|
+
a dependabot bump of one without the other leaves an unmet peer that installs fine and only
|
|
119
|
+
misbehaves at runtime.
|
|
120
|
+
|
|
109
121
|
## Depends On
|
|
110
122
|
|
|
111
|
-
`@owlmeans/i18n`, `@owlmeans/client-context`, `i18next
|
|
123
|
+
`@owlmeans/i18n`, `@owlmeans/client-context`, `i18next` (>= 26.2), `react-i18next` (>= 17),
|
|
124
|
+
`react` (peer)
|
package/build/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAKxC,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAI3C,CAAA;AAEF,kGAAkG;AAClG,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAKxC,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAI3C,CAAA;AAEF,kGAAkG;AAClG,eAAO,MAAM,aAAa,YAAa,MAAM,UAAU,MAAM,KAAG,MAK/D,CAAA;AAyCD;4FAC4F;AAC5F,eAAO,MAAM,OAAO,aAAc,MAAM,OAAO,MAAM,WAAW,MAAM,KAAG,SAExE,CAAA;AAED,eAAO,MAAM,UAAU,YAAa,MAAM,WAAW,MAAM,KAAG,SAE7D,CAAA;AAED,eAAO,MAAM,UAAU,aAAc,MAAM,WAAW,MAAM,KAAG,SAK9D,CAAA;AAED,eAAO,MAAM,WAAW,QAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAU5D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/utils/instance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAO5D,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/utils/instance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAO5D,eAAO,MAAM,eAAe,WAAY,YAAY,KAAG,IAItD,CAAA;AAED,eAAO,MAAM,eAAe,WAAY,YAAY,KAAG,IAC3B,CAAA;AAE5B,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,IAMzC,CAAA"}
|
package/build/utils/instance.js
CHANGED
|
@@ -37,7 +37,10 @@ const createI18nInstance = (config) => {
|
|
|
37
37
|
? persistedLng
|
|
38
38
|
: fallbackLng;
|
|
39
39
|
const instance = createInstance({
|
|
40
|
-
compatibilityJSON
|
|
40
|
+
// No `compatibilityJSON` — i18next >= 26 accepts only the v4 JSON format
|
|
41
|
+
// (Intl.PluralRules suffixes `_one`/`_other`, not the v3 `_plural`/`_0`/`_1`).
|
|
42
|
+
// No resource in the ecosystem uses plural-suffixed keys; `{{count}}` is plain
|
|
43
|
+
// interpolation, so the v4 default is a no-op here.
|
|
41
44
|
defaultNS: config.i18n?.defaultNs ?? DEFAULT_NAMESPACE,
|
|
42
45
|
fallbackLng,
|
|
43
46
|
lng,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.js","sourceRoot":"","sources":["../../src/utils/instance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE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AO,YAAY,GAAG,QAAQ,CAAA;AAChC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/client-i18n",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"@owlmeans/dep-config": "workspace:*",
|
|
35
35
|
"@types/react": "^19.2.17",
|
|
36
36
|
"nodemon": "^3.1.14",
|
|
37
|
-
"typescript": "^
|
|
37
|
+
"typescript": "^7.0.2"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@owlmeans/client": "^0.1.
|
|
41
|
-
"@owlmeans/client-context": "^0.1.
|
|
42
|
-
"@owlmeans/i18n": "^0.1.
|
|
43
|
-
"i18next": "^
|
|
44
|
-
"react-i18next": "^
|
|
40
|
+
"@owlmeans/client": "^0.1.17",
|
|
41
|
+
"@owlmeans/client-context": "^0.1.17",
|
|
42
|
+
"@owlmeans/i18n": "^0.1.17",
|
|
43
|
+
"i18next": "^26.2.0",
|
|
44
|
+
"react-i18next": "^17.0.11"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
package/src/utils/instance.ts
CHANGED
|
@@ -48,7 +48,10 @@ const createI18nInstance = (config: ClientConfig): i18n => {
|
|
|
48
48
|
: fallbackLng
|
|
49
49
|
|
|
50
50
|
const instance = createInstance({
|
|
51
|
-
compatibilityJSON
|
|
51
|
+
// No `compatibilityJSON` — i18next >= 26 accepts only the v4 JSON format
|
|
52
|
+
// (Intl.PluralRules suffixes `_one`/`_other`, not the v3 `_plural`/`_0`/`_1`).
|
|
53
|
+
// No resource in the ecosystem uses plural-suffixed keys; `{{count}}` is plain
|
|
54
|
+
// interpolation, so the v4 default is a no-op here.
|
|
52
55
|
defaultNS: config.i18n?.defaultNs ?? DEFAULT_NAMESPACE,
|
|
53
56
|
fallbackLng,
|
|
54
57
|
lng,
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "How to use @owlmeans/client-i18n — React i18next wrapper with lazy bundle loading and language persistence. Use when setting up i18n in a React app or adding translation hooks."
|
|
3
|
-
applyTo: "**/*.ts, **/*.tsx"
|
|
4
|
-
---
|
|
5
|
-
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
6
|
-
|
|
7
|
-
# @owlmeans/client-i18n
|
|
8
|
-
|
|
9
|
-
**Layer:** Client (React)
|
|
10
|
-
**Version:** `"@owlmeans/client-i18n": "^0.1.16-rc.0"`
|
|
11
|
-
|
|
12
|
-
## Key exports
|
|
13
|
-
|
|
14
|
-
| Export | Description |
|
|
15
|
-
|--------|-------------|
|
|
16
|
-
| `I18nContext` | Provider — wraps the app tree |
|
|
17
|
-
| `useI18nLib(resource, prefix?)` | Hook for library strings (ns=`'lib'`) |
|
|
18
|
-
| `useI18nApp(resource?, prefix?)` | Hook for app strings (ns=resource name) |
|
|
19
|
-
| `useI18n(resource, ns?, prefix?)` | Low-level explicit hook |
|
|
20
|
-
| `useLanguage()` | `[lng, setLng]` — read/switch active language |
|
|
21
|
-
| `composePrefix(parent?, child?)` | Dot-join for prefix segments |
|
|
22
|
-
| `I18nProps`, `I18nBaseProps` | Prop types for i18n overrides |
|
|
23
|
-
|
|
24
|
-
## Setup
|
|
25
|
-
|
|
26
|
-
```tsx
|
|
27
|
-
import { I18nContext } from '@owlmeans/client-i18n'
|
|
28
|
-
<I18nContext config={clientConfig}><App /></I18nContext>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Translation hooks
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
// Library component
|
|
35
|
-
const t = useI18nLib('errors', 'form') // lib:errors.form.*
|
|
36
|
-
t('minLength')
|
|
37
|
-
|
|
38
|
-
// App component
|
|
39
|
-
const t = useI18nApp(undefined, 'home') // appName:appName.home.*
|
|
40
|
-
t('title')
|
|
41
|
-
|
|
42
|
-
// Language switcher
|
|
43
|
-
const [lng, setLng] = useLanguage()
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Key invariants
|
|
47
|
-
|
|
48
|
-
- Use `useI18nLib` in `@owlmeans/*` packages, `useI18nApp` in app/project packages.
|
|
49
|
-
- Never hardcode UI strings — always use a translation hook.
|
|
50
|
-
- Language is persisted in `localStorage` under `owlmeans-lng`.
|
|
51
|
-
|
|
52
|
-
## Depends On
|
|
53
|
-
|
|
54
|
-
`@owlmeans/i18n`, `@owlmeans/client-context`, `i18next`, `react-i18next`, `react` (peer)
|