react-i18next 11.15.4 β 11.15.7
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/CHANGELOG.md +12 -0
- package/LICENSE +1 -1
- package/README.md +4 -4
- package/package.json +2 -2
- package/ts4.1/index.d.ts +16 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
### 11.15.7
|
|
2
|
+
|
|
3
|
+
- types: add nsSeparator to CustomTypeOptions [1471](https://github.com/i18next/react-i18next/pull/1471)
|
|
4
|
+
|
|
5
|
+
### 11.15.6
|
|
6
|
+
|
|
7
|
+
- fix error for typescript 4.6 [1453](https://github.com/i18next/react-i18next/pull/1463)
|
|
8
|
+
|
|
9
|
+
### 11.15.5
|
|
10
|
+
|
|
11
|
+
- types: fix never return type when using plurals [1453](https://github.com/i18next/react-i18next/pull/1453)
|
|
12
|
+
|
|
1
13
|
### 11.15.4
|
|
2
14
|
|
|
3
15
|
- types: add values field to Plural component in macros [1446](https://github.com/i18next/react-i18next/pull/1446)
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -144,10 +144,10 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
|
|
|
144
144
|
<!-- markdownlint-disable -->
|
|
145
145
|
<table>
|
|
146
146
|
<tr>
|
|
147
|
-
<td align="center"><a href="http://twitter.com/jamuhl"><img src="https://avatars3.githubusercontent.com/u/977772?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jan MΓΌhlemann</b></sub></a><br /><a href="https://github.com/i18next/react-i18next/commits?author=jamuhl" title="Code">π»</a> <a href="#example-jamuhl" title="Examples">π‘</a> <a href="https://github.com/i18next/react-i18next/commits?author=jamuhl" title="Documentation">π</a> <a href="#question-jamuhl" title="Answering Questions">π¬</a></td>
|
|
148
|
-
<td align="center"><a href="http://twitter.com/#!/adrirai"><img src="https://avatars0.githubusercontent.com/u/1086194?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Adriano Raiano</b></sub></a><br /><a href="https://github.com/i18next/react-i18next/commits?author=adrai" title="Code">π»</a> <a href="#example-adrai" title="Examples">π‘</a> <a href="https://github.com/i18next/react-i18next/commits?author=adrai" title="Documentation">π</a> <a href="#question-adrai" title="Answering Questions">π¬</a></td>
|
|
149
|
-
<td align="center"><a href="https://
|
|
150
|
-
<td align="center"><a href="https://
|
|
147
|
+
<td align="center"><a href="http://twitter.com/jamuhl"><img src="https://avatars3.githubusercontent.com/u/977772?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jan MΓΌhlemann</b></sub></a><br /><a href="https://github.com/i18next/react-i18next/commits?author=jamuhl" title="Code">π»</a> <a href="#example-jamuhl" title="Examples">π‘</a> <a href="https://github.com/i18next/react-i18next/pulls?q=is%3Apr+reviewed-by%3Ajamuhl+" title="Reviewed Pull Requests">π</a> <a href="https://github.com/i18next/react-i18next/commits?author=jamuhl" title="Documentation">π</a> <a href="#question-jamuhl" title="Answering Questions">π¬</a></td>
|
|
148
|
+
<td align="center"><a href="http://twitter.com/#!/adrirai"><img src="https://avatars0.githubusercontent.com/u/1086194?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Adriano Raiano</b></sub></a><br /><a href="https://github.com/i18next/react-i18next/commits?author=adrai" title="Code">π»</a> <a href="#example-adrai" title="Examples">π‘</a> <a href="https://github.com/i18next/react-i18next/pulls?q=is%3Apr+reviewed-by%3Aadrai+" title="Reviewed Pull Requests">π</a> <a href="https://github.com/i18next/react-i18next/commits?author=adrai" title="Documentation">π</a> <a href="#question-adrai" title="Answering Questions">π¬</a></td>
|
|
149
|
+
<td align="center"><a href="https://github.com/pedrodurek"><img src="https://avatars1.githubusercontent.com/u/12190482?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Pedro Durek</b></sub></a><br /><a href="https://github.com/i18next/react-i18next/commits?author=pedrodurek" title="Code">π»</a> <a href="#example-pedrodurek" title="Examples">π‘</a> <a href="https://github.com/i18next/react-i18next/pulls?q=is%3Apr+reviewed-by%3Apedrodurek+" title="Reviewed Pull Requests">π</a> <a href="#question-pedrodurek" title="Answering Questions">π¬</a></td>
|
|
150
|
+
<td align="center"><a href="https://tigerabrodi.dev/"><img src="https://avatars1.githubusercontent.com/u/49603590?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tiger Abrodi</b></sub></a><br /><a href="https://github.com/i18next/react-i18next/commits?author=tigerabrodi" title="Code">π»</a> <a href="https://github.com/i18next/react-i18next/pulls?q=is%3Apr+reviewed-by%3Atigerabrodi" title="Reviewed Pull Requests">π</a></td>
|
|
151
151
|
</tr>
|
|
152
152
|
</table>
|
|
153
153
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-i18next",
|
|
3
|
-
"version": "11.15.
|
|
3
|
+
"version": "11.15.7",
|
|
4
4
|
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.",
|
|
5
5
|
"main": "dist/commonjs/index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"rollup-plugin-terser": "^5.1.1",
|
|
87
87
|
"sinon": "^7.2.3",
|
|
88
88
|
"tslint": "^5.20.1",
|
|
89
|
-
"typescript": "
|
|
89
|
+
"typescript": "4.6.2",
|
|
90
90
|
"yargs": "^13.3.0"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
package/ts4.1/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export interface Resources {}
|
|
|
37
37
|
* defaultNS: 'custom';
|
|
38
38
|
* returnNull: false;
|
|
39
39
|
* returnEmptyString: false;
|
|
40
|
+
* nsSeparator: ':';
|
|
40
41
|
* keySeparator: '.';
|
|
41
42
|
* jsonFormat: 'v4';
|
|
42
43
|
* resources: {
|
|
@@ -57,6 +58,7 @@ type TypeOptions = MergeBy<
|
|
|
57
58
|
returnNull: true;
|
|
58
59
|
returnEmptyString: true;
|
|
59
60
|
keySeparator: '.';
|
|
61
|
+
nsSeparator: ':';
|
|
60
62
|
defaultNS: 'translation';
|
|
61
63
|
jsonFormat: 'v4';
|
|
62
64
|
resources: Resources;
|
|
@@ -95,8 +97,10 @@ declare module 'i18next' {
|
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
|
|
100
|
+
type PluralSuffix = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
|
|
101
|
+
|
|
98
102
|
type WithOrWithoutPlural<K> = TypeOptions['jsonFormat'] extends 'v4'
|
|
99
|
-
? K extends `${infer B}_${
|
|
103
|
+
? K extends `${infer B}_${PluralSuffix}`
|
|
100
104
|
? B | K
|
|
101
105
|
: K
|
|
102
106
|
: K;
|
|
@@ -119,15 +123,16 @@ type Normalize2<T, K = keyof T> = K extends keyof T
|
|
|
119
123
|
type Normalize<T> = WithOrWithoutPlural<keyof T> | Normalize2<T>;
|
|
120
124
|
|
|
121
125
|
// Normalize multiple namespaces
|
|
126
|
+
type KeyWithNSSeparator<N, K, S extends string = TypeOptions['nsSeparator']> = `${N &
|
|
127
|
+
string}${S}${K & string}`;
|
|
122
128
|
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void
|
|
123
129
|
? I
|
|
124
130
|
: never;
|
|
125
131
|
type LastOf<T> = UnionToIntersection<T extends any ? () => T : never> extends () => infer R
|
|
126
132
|
? R
|
|
127
133
|
: never;
|
|
128
|
-
type AppendNS<N, K> = `${N & string}:${K & string}`;
|
|
129
134
|
type NormalizeMulti<T, U extends keyof T, L = LastOf<U>> = L extends U
|
|
130
|
-
?
|
|
135
|
+
? KeyWithNSSeparator<L, Normalize<T[L]>> | NormalizeMulti<T, Exclude<U, L>>
|
|
131
136
|
: never;
|
|
132
137
|
|
|
133
138
|
interface CustomTypeParameters {
|
|
@@ -150,6 +155,12 @@ export type NormalizeByTypeOptions<
|
|
|
150
155
|
R = TypeOptionsFallback<TranslationValue, Options['returnEmptyString'], ''>
|
|
151
156
|
> = TypeOptionsFallback<R, Options['returnNull'], null>;
|
|
152
157
|
|
|
158
|
+
type StringIfPlural<T> = TypeOptions['jsonFormat'] extends 'v4'
|
|
159
|
+
? T extends `${string}_${PluralSuffix}`
|
|
160
|
+
? string
|
|
161
|
+
: never
|
|
162
|
+
: never;
|
|
163
|
+
|
|
153
164
|
type NormalizeReturn<
|
|
154
165
|
T,
|
|
155
166
|
V,
|
|
@@ -162,7 +173,7 @@ type NormalizeReturn<
|
|
|
162
173
|
? K extends keyof T
|
|
163
174
|
? NormalizeReturn<T[K], R>
|
|
164
175
|
: never
|
|
165
|
-
:
|
|
176
|
+
: StringIfPlural<keyof T>;
|
|
166
177
|
|
|
167
178
|
type NormalizeMultiReturn<T, V> = V extends `${infer N}:${infer R}`
|
|
168
179
|
? N extends keyof T
|
|
@@ -319,7 +330,7 @@ export function withTranslation<N extends Namespace = DefaultNamespace>(
|
|
|
319
330
|
withRef?: boolean;
|
|
320
331
|
},
|
|
321
332
|
): <
|
|
322
|
-
C extends React.ComponentType<React.ComponentProps<
|
|
333
|
+
C extends React.ComponentType<React.ComponentProps<any> & WithTranslationProps>,
|
|
323
334
|
ResolvedProps = JSX.LibraryManagedAttributes<
|
|
324
335
|
C,
|
|
325
336
|
Subtract<React.ComponentProps<C>, WithTranslationProps>
|