react-i18next 11.16.6 → 11.16.9
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/README.md +1 -1
- package/package.json +2 -2
- package/ts4.1/index.d.ts +13 -3
- package/tslint.json +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
### 11.16.9
|
|
2
|
+
|
|
3
|
+
- types: fix missing generic type for HTMLAttributes [1499](https://github.com/i18next/react-i18next/pull/1499)
|
|
4
|
+
|
|
5
|
+
### 11.16.8
|
|
6
|
+
|
|
7
|
+
- types: fix Trans component to support react 18 types, by introducing allowObjectInHTMLChildren TS option [1492](https://github.com/i18next/react-i18next/pull/1492)
|
|
8
|
+
|
|
9
|
+
### 11.16.7
|
|
10
|
+
|
|
11
|
+
- types: Added objects explicitly to Trans children [1486](https://github.com/i18next/react-i18next/pull/1486)
|
|
12
|
+
|
|
1
13
|
### 11.16.6
|
|
2
14
|
|
|
3
15
|
- fix: warn just once 'i18n.languages were undefined or empty' and return true, like before
|
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ Head over to the **interactive playground** at [codesandbox](https://codesandbox
|
|
|
75
75
|
### Why i18next?
|
|
76
76
|
|
|
77
77
|
- **Simplicity:** no need to change your webpack configuration or add additional babel transpilers, just use create-react-app and go.
|
|
78
|
-
- **Production ready** we know there are more needs for production than just doing i18n on the clientside, so we offer wider support on [serverside](https://www.i18next.com/supported-frameworks
|
|
78
|
+
- **Production ready** we know there are more needs for production than just doing i18n on the clientside, so we offer wider support on [serverside](https://www.i18next.com/overview/supported-frameworks) too (nodejs, php, ruby, .net, ...). **Learn once - translate everywhere**.
|
|
79
79
|
- **Beyond i18n** comes with [locize](https://locize.com) bridging the gap between developement and translations - covering the whole translation process.
|
|
80
80
|
|
|
81
81
|

|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-i18next",
|
|
3
|
-
"version": "11.16.
|
|
3
|
+
"version": "11.16.9",
|
|
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",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"rollup-plugin-replace": "^2.1.0",
|
|
86
86
|
"rollup-plugin-terser": "^5.1.1",
|
|
87
87
|
"sinon": "^7.2.3",
|
|
88
|
-
"tslint": "^
|
|
88
|
+
"tslint": "^6.1.3",
|
|
89
89
|
"typescript": "4.6.2",
|
|
90
90
|
"yargs": "^13.3.0"
|
|
91
91
|
},
|
package/ts4.1/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export interface Resources {}
|
|
|
40
40
|
* nsSeparator: ':';
|
|
41
41
|
* keySeparator: '.';
|
|
42
42
|
* jsonFormat: 'v4';
|
|
43
|
+
* allowObjectInHTMLChildren: false;
|
|
43
44
|
* resources: {
|
|
44
45
|
* custom: {
|
|
45
46
|
* foo: 'foo';
|
|
@@ -62,6 +63,7 @@ type TypeOptions = MergeBy<
|
|
|
62
63
|
defaultNS: 'translation';
|
|
63
64
|
jsonFormat: 'v4';
|
|
64
65
|
resources: Resources;
|
|
66
|
+
allowObjectInHTMLChildren: false;
|
|
65
67
|
},
|
|
66
68
|
CustomTypeOptions
|
|
67
69
|
>;
|
|
@@ -97,6 +99,15 @@ declare module 'i18next' {
|
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
|
|
102
|
+
type ObjectOrNever = TypeOptions['allowObjectInHTMLChildren'] extends true
|
|
103
|
+
? Record<string, unknown>
|
|
104
|
+
: never;
|
|
105
|
+
declare module 'react' {
|
|
106
|
+
interface HTMLAttributes<T> {
|
|
107
|
+
children?: ReactNode | ObjectOrNever;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
100
111
|
type PluralSuffix = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
|
|
101
112
|
|
|
102
113
|
type WithOrWithoutPlural<K> = TypeOptions['jsonFormat'] extends 'v4'
|
|
@@ -228,7 +239,6 @@ export type TFuncReturn<
|
|
|
228
239
|
export interface TFunction<N extends Namespace = DefaultNamespace, TKPrefix = undefined> {
|
|
229
240
|
<
|
|
230
241
|
TKeys extends TFuncKey<N, TKPrefix> | TemplateStringsArray extends infer A ? A : never,
|
|
231
|
-
// tslint:disable-next-line:no-null-undefined-union
|
|
232
242
|
TDefaultResult extends TFunctionResult | React.ReactNode = string,
|
|
233
243
|
TInterpolationMap extends object = StringMap
|
|
234
244
|
>(
|
|
@@ -237,7 +247,6 @@ export interface TFunction<N extends Namespace = DefaultNamespace, TKPrefix = un
|
|
|
237
247
|
): TFuncReturn<N, TKeys, TDefaultResult, TKPrefix>;
|
|
238
248
|
<
|
|
239
249
|
TKeys extends TFuncKey<N, TKPrefix> | TemplateStringsArray extends infer A ? A : never,
|
|
240
|
-
// tslint:disable-next-line:no-null-undefined-union
|
|
241
250
|
TDefaultResult extends TFunctionResult | React.ReactNode = string,
|
|
242
251
|
TInterpolationMap extends object = StringMap
|
|
243
252
|
>(
|
|
@@ -247,13 +256,14 @@ export interface TFunction<N extends Namespace = DefaultNamespace, TKPrefix = un
|
|
|
247
256
|
): TFuncReturn<N, TKeys, TDefaultResult, TKPrefix>;
|
|
248
257
|
}
|
|
249
258
|
|
|
259
|
+
type TransChild = React.ReactNode | Record<string, unknown>;
|
|
250
260
|
export type TransProps<
|
|
251
261
|
K extends TFuncKey<N, TKPrefix> extends infer A ? A : never,
|
|
252
262
|
N extends Namespace = DefaultNamespace,
|
|
253
263
|
TKPrefix = undefined,
|
|
254
264
|
E = React.HTMLProps<HTMLDivElement>
|
|
255
265
|
> = E & {
|
|
256
|
-
children?:
|
|
266
|
+
children?: TransChild | TransChild[];
|
|
257
267
|
components?: readonly React.ReactNode[] | { readonly [tagName: string]: React.ReactNode };
|
|
258
268
|
count?: number;
|
|
259
269
|
context?: string;
|