i18next 26.1.0 → 26.2.0
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/.claude/settings.local.json +27 -0
- package/README.md +1 -1
- package/dist/esm/package.json +1 -1
- package/package.json +1 -1
- package/typescript/options.d.ts +34 -0
- package/typescript/t.d.ts +4 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(gh pr *)",
|
|
5
|
+
"Read(//Users/adrai/Projects/i18next/react-i18next/**)",
|
|
6
|
+
"Bash(git add *)",
|
|
7
|
+
"Bash(git commit *)",
|
|
8
|
+
"Read(//Users/adrai/Projects/i18next/**)",
|
|
9
|
+
"Bash(gh issue *)",
|
|
10
|
+
"Read(//tmp/**)",
|
|
11
|
+
"WebFetch(domain:github.com)",
|
|
12
|
+
"Bash(grep -n '$PreservedValue\\\\b' /Users/adrai/Projects/i18next/i18next/typescript/helpers.d.ts)",
|
|
13
|
+
"Bash(npm run *)",
|
|
14
|
+
"Bash(cat > *)",
|
|
15
|
+
"Bash(python3 -c \"import json,sys; print\\(json.load\\(sys.stdin\\)['version']\\)\")",
|
|
16
|
+
"Bash(npm test *)",
|
|
17
|
+
"Bash(git pull *)",
|
|
18
|
+
"Bash(git push *)"
|
|
19
|
+
],
|
|
20
|
+
"additionalDirectories": [
|
|
21
|
+
"/Users/adrai/Projects/i18next/react-i18next",
|
|
22
|
+
"/tmp",
|
|
23
|
+
"/Users/adrai/Projects/i18next/i18next-gitbook/overview",
|
|
24
|
+
"/Users/adrai/Projects/i18next/i18next-icu"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
}
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ i18next provides:
|
|
|
23
23
|
- Extensibility: eg. [sprintf](https://www.i18next.com/overview/plugins-and-utils#post-processors)
|
|
24
24
|
- ...
|
|
25
25
|
|
|
26
|
-
> **Pro Tip:** Looking for a way to manage your translations? Locize is the official service by i18next's creators and
|
|
26
|
+
> **Pro Tip:** Looking for a way to manage your translations? [Locize](https://www.locize.com?utm_source=i18next_readme&utm_medium=github&utm_campaign=readme) is the official service by i18next's creators — drop in [`i18next-locize-backend`](https://github.com/locize/i18next-locize-backend) for CDN delivery, AI translation, and no redeploys for copy changes. **[Free plan](https://www.locize.com/pricing?utm_source=i18next_readme&utm_medium=github&utm_campaign=readme)** available for small projects.
|
|
27
27
|
|
|
28
28
|
For more information visit the website:
|
|
29
29
|
|
package/dist/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"26.
|
|
1
|
+
{"type":"module","version":"26.2.0"}
|
package/package.json
CHANGED
package/typescript/options.d.ts
CHANGED
|
@@ -96,6 +96,27 @@ export type TypeOptions = $MergeBy<
|
|
|
96
96
|
/** @see {InterpolationOptions.unescapeSuffix} */
|
|
97
97
|
unescapeSuffix: '';
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Whether to extract interpolation variables from translation strings at
|
|
101
|
+
* the type level. When `true` (default), the type system parses each
|
|
102
|
+
* resource value for `{{variable}}` patterns and types the `t()` options
|
|
103
|
+
* accordingly.
|
|
104
|
+
*
|
|
105
|
+
* Set to `false` when your translation strings use a different
|
|
106
|
+
* interpolation syntax that the i18next type extractor cannot understand
|
|
107
|
+
* — e.g. ICU MessageFormat plurals like `{count, plural, one {{count} row}
|
|
108
|
+
* other {{count} rows}}` would otherwise produce phantom variable names
|
|
109
|
+
* because the default extractor naively matches the outermost `{{` …
|
|
110
|
+
* `}}`. This flag is type-only; runtime interpolation is governed by
|
|
111
|
+
* `InterpolationOptions` and is unaffected.
|
|
112
|
+
*
|
|
113
|
+
* Required by `i18next-icu` users — see that package's docs for the
|
|
114
|
+
* recommended `CustomTypeOptions` augmentation.
|
|
115
|
+
*
|
|
116
|
+
* @default true
|
|
117
|
+
*/
|
|
118
|
+
parseInterpolation: true;
|
|
119
|
+
|
|
99
120
|
/**
|
|
100
121
|
* Use a proxy-based selector to select a translation.
|
|
101
122
|
*
|
|
@@ -641,6 +662,19 @@ export interface InitOptions<T = object> extends PluginOptions<T> {
|
|
|
641
662
|
*/
|
|
642
663
|
nsSeparator?: false | string;
|
|
643
664
|
|
|
665
|
+
/**
|
|
666
|
+
* Selector-API mode. Mirrors `CustomTypeOptions['enableSelector']`.
|
|
667
|
+
*
|
|
668
|
+
* - `false` (default): selector API disabled.
|
|
669
|
+
* - `true` / `'optimize'`: selector resolution enabled.
|
|
670
|
+
* - `'strict'`: require an explicit namespace as the first selector
|
|
671
|
+
* path segment in every call. The resolver always rewrites a leading
|
|
672
|
+
* namespace-matching segment as a namespace prefix.
|
|
673
|
+
*
|
|
674
|
+
* @default false
|
|
675
|
+
*/
|
|
676
|
+
enableSelector?: false | true | 'optimize' | 'strict';
|
|
677
|
+
|
|
644
678
|
/**
|
|
645
679
|
* Char to split plural from key
|
|
646
680
|
* @default '_'
|
package/typescript/t.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ type _UnescapePrefix = TypeOptions['unescapePrefix'];
|
|
|
36
36
|
type _UnescapeSuffix = TypeOptions['unescapeSuffix'];
|
|
37
37
|
type _StrictKeyChecks = TypeOptions['strictKeyChecks'];
|
|
38
38
|
type _EnableSelector = TypeOptions['enableSelector'];
|
|
39
|
+
type _ParseInterpolation = TypeOptions['parseInterpolation'];
|
|
39
40
|
type _InterpolationFormatTypeMap = TypeOptions['interpolationFormatTypeMap'];
|
|
40
41
|
|
|
41
42
|
type $IsResourcesDefined = [keyof _Resources] extends [never] ? false : true;
|
|
@@ -168,8 +169,9 @@ type ParseActualValue<Ret> = Ret extends `${_UnescapePrefix}${infer ActualValue}
|
|
|
168
169
|
: Ret;
|
|
169
170
|
|
|
170
171
|
/** Parses interpolation entries as `[variableName, formatSpecifier | never]` tuples. */
|
|
171
|
-
type ParseInterpolationEntries<Ret> =
|
|
172
|
-
|
|
172
|
+
type ParseInterpolationEntries<Ret> = [_ParseInterpolation] extends [false]
|
|
173
|
+
? never
|
|
174
|
+
: Ret extends `${string}${_InterpolationPrefix}${infer Value}${_InterpolationSuffix}${infer Rest}`
|
|
173
175
|
?
|
|
174
176
|
| (Value extends `${infer ActualValue},${infer Format}`
|
|
175
177
|
? [ParseActualValue<ActualValue>, TrimSpaces<Format>]
|