react-i18next 11.16.7 → 11.16.8

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 CHANGED
@@ -1,3 +1,7 @@
1
+ ### 11.16.8
2
+
3
+ - types: fix Trans component to support react 18 types, by introducing allowObjectInHTMLChildren TS option [1492](https://github.com/i18next/react-i18next/pull/1492)
4
+
1
5
  ### 11.16.7
2
6
 
3
7
  - types: Added objects explicitly to Trans children [1486](https://github.com/i18next/react-i18next/pull/1486)
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.html) too (nodejs, php, ruby, .net, ...). **Learn once - translate everywhere**.
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
  ![ecosystem](https://raw.githubusercontent.com/i18next/i18next/master/assets/i18next-ecosystem.jpg)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-i18next",
3
- "version": "11.16.7",
3
+ "version": "11.16.8",
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",
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 {
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'
@@ -245,13 +256,14 @@ export interface TFunction<N extends Namespace = DefaultNamespace, TKPrefix = un
245
256
  ): TFuncReturn<N, TKeys, TDefaultResult, TKPrefix>;
246
257
  }
247
258
 
259
+ type TransChild = React.ReactNode | Record<string, unknown>;
248
260
  export type TransProps<
249
261
  K extends TFuncKey<N, TKPrefix> extends infer A ? A : never,
250
262
  N extends Namespace = DefaultNamespace,
251
263
  TKPrefix = undefined,
252
264
  E = React.HTMLProps<HTMLDivElement>
253
265
  > = E & {
254
- children?: React.ReactNode | Record<string, unknown>;
266
+ children?: TransChild | TransChild[];
255
267
  components?: readonly React.ReactNode[] | { readonly [tagName: string]: React.ReactNode };
256
268
  count?: number;
257
269
  context?: string;