react-i18next 11.15.1 → 11.15.5
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 +16 -0
- package/LICENSE +1 -1
- package/README.md +3 -8
- package/package.json +12 -4
- package/ts4.1/icu.macro.d.ts +1 -0
- package/ts4.1/index.d.ts +17 -9
- package/tslint.json +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
### 11.15.5
|
|
2
|
+
|
|
3
|
+
- types: fix never return type when using plurals [1453](https://github.com/i18next/react-i18next/pull/1453)
|
|
4
|
+
|
|
5
|
+
### 11.15.4
|
|
6
|
+
|
|
7
|
+
- types: add values field to Plural component in macros [1446](https://github.com/i18next/react-i18next/pull/1446)
|
|
8
|
+
|
|
9
|
+
### 11.15.3
|
|
10
|
+
|
|
11
|
+
- types: fix for issue introduced with type extension for react-native [1436](https://github.com/i18next/react-i18next/pull/1436)
|
|
12
|
+
|
|
13
|
+
### 11.15.2
|
|
14
|
+
|
|
15
|
+
- types: TypeScript interface for the Trans component does now accept react-native props [1418](https://github.com/i18next/react-i18next/pull/1418)
|
|
16
|
+
|
|
1
17
|
### 11.15.1
|
|
2
18
|
|
|
3
19
|
- add missing types for shouldUnescape and useTranslation [1429](https://github.com/i18next/react-i18next/pull/1429)
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -4,15 +4,9 @@
|
|
|
4
4
|
[](https://codeclimate.com/github/i18next/react-i18next)
|
|
5
5
|
[](https://coveralls.io/github/i18next/react-i18next)
|
|
6
6
|
[![Quality][quality-badge] ][quality-url]
|
|
7
|
-
[![dependencies][dependencies-image] ][dependencies-url]
|
|
8
|
-
[![devdependencies][devdependencies-image] ][devdependencies-url]
|
|
9
7
|
|
|
10
8
|
[npm-icon]: https://nodei.co/npm/react-i18next.png?downloads=true
|
|
11
9
|
[npm-url]: https://npmjs.org/package/react-i18next
|
|
12
|
-
[dependencies-image]: https://david-dm.org/i18next/react-i18next.png
|
|
13
|
-
[dependencies-url]: https://david-dm.org/i18next/react-i18next
|
|
14
|
-
[devdependencies-image]: https://david-dm.org/i18next/react-i18next/dev-status.png
|
|
15
|
-
[devdependencies-url]: https://david-dm.org/i18next/react-i18next#info=devDependencies
|
|
16
10
|
[quality-badge]: http://npm.packagequality.com/shield/react-i18next.svg
|
|
17
11
|
[quality-url]: http://packagequality.com/#?package=react-i18next
|
|
18
12
|
|
|
@@ -36,8 +30,9 @@ npm i react-i18next@legacy
|
|
|
36
30
|
|
|
37
31
|
### Documentation
|
|
38
32
|
|
|
39
|
-
The documentation is published on [react.i18next.com](https://react.i18next.com)
|
|
40
|
-
|
|
33
|
+
The documentation is published on [react.i18next.com](https://react.i18next.com) and PR changes can be supplied [here](https://github.com/i18next/react-i18next-gitbook).
|
|
34
|
+
|
|
35
|
+
The general i18next documentation is published on [www.i18next.com](https://www.i18next.com) and PR changes can be supplied [here](https://github.com/i18next/i18next-gitbook).
|
|
41
36
|
|
|
42
37
|
### What will my code look like?
|
|
43
38
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-i18next",
|
|
3
|
-
"version": "11.15.
|
|
3
|
+
"version": "11.15.5",
|
|
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",
|
|
@@ -93,6 +93,14 @@
|
|
|
93
93
|
"i18next": ">= 19.0.0",
|
|
94
94
|
"react": ">= 16.8.0"
|
|
95
95
|
},
|
|
96
|
+
"peerDependenciesMeta": {
|
|
97
|
+
"react-dom": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"react-native": {
|
|
101
|
+
"optional": true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
96
104
|
"scripts": {
|
|
97
105
|
"clean": "rimraf dist && mkdirp dist",
|
|
98
106
|
"copy": "cp-cli ./dist/umd/react-i18next.min.js ./react-i18next.min.js && cp-cli ./dist/umd/react-i18next.js ./react-i18next.js",
|
|
@@ -109,9 +117,9 @@
|
|
|
109
117
|
"test:watch": "cross-env BABEL_ENV=development jest --no-cache --watch",
|
|
110
118
|
"test:coverage": "cross-env BABEL_ENV=development jest --no-cache --coverage",
|
|
111
119
|
"test:lint": "eslint ./src ./test",
|
|
112
|
-
"test:typescript": "tslint --project tsconfig.json",
|
|
113
|
-
"test:typescript:noninterop": "tslint --project tsconfig.nonEsModuleInterop.json",
|
|
114
|
-
"test:typescript:customtypes": "tslint --project ./test/typescript/custom-types/tsconfig.json",
|
|
120
|
+
"test:typescript": "tslint --project tsconfig.json '**/*.ts'",
|
|
121
|
+
"test:typescript:noninterop": "tslint --project tsconfig.nonEsModuleInterop.json '**/*.ts'",
|
|
122
|
+
"test:typescript:customtypes": "tslint --project ./test/typescript/custom-types/tsconfig.json '**/*.ts'",
|
|
115
123
|
"contributors:add": "all-contributors add",
|
|
116
124
|
"contributors:generate": "all-contributors generate",
|
|
117
125
|
"prettier": "prettier --write \"{,**/}*.{ts,tsx,js,json,md}\""
|
package/ts4.1/icu.macro.d.ts
CHANGED
package/ts4.1/index.d.ts
CHANGED
|
@@ -95,8 +95,10 @@ declare module 'i18next' {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
type PluralSuffix = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
|
|
99
|
+
|
|
98
100
|
type WithOrWithoutPlural<K> = TypeOptions['jsonFormat'] extends 'v4'
|
|
99
|
-
? K extends `${infer B}_${
|
|
101
|
+
? K extends `${infer B}_${PluralSuffix}`
|
|
100
102
|
? B | K
|
|
101
103
|
: K
|
|
102
104
|
: K;
|
|
@@ -130,10 +132,10 @@ type NormalizeMulti<T, U extends keyof T, L = LastOf<U>> = L extends U
|
|
|
130
132
|
? AppendNS<L, Normalize<T[L]>> | NormalizeMulti<T, Exclude<U, L>>
|
|
131
133
|
: never;
|
|
132
134
|
|
|
133
|
-
|
|
135
|
+
interface CustomTypeParameters {
|
|
134
136
|
returnNull?: boolean;
|
|
135
137
|
returnEmptyString?: boolean;
|
|
136
|
-
}
|
|
138
|
+
}
|
|
137
139
|
|
|
138
140
|
type TypeOptionsFallback<TranslationValue, Option, MatchingValue> = Option extends false
|
|
139
141
|
? TranslationValue extends MatchingValue
|
|
@@ -150,6 +152,12 @@ export type NormalizeByTypeOptions<
|
|
|
150
152
|
R = TypeOptionsFallback<TranslationValue, Options['returnEmptyString'], ''>
|
|
151
153
|
> = TypeOptionsFallback<R, Options['returnNull'], null>;
|
|
152
154
|
|
|
155
|
+
type StringIfPlural<T> = TypeOptions['jsonFormat'] extends 'v4'
|
|
156
|
+
? T extends `${string}_${PluralSuffix}`
|
|
157
|
+
? string
|
|
158
|
+
: never
|
|
159
|
+
: never;
|
|
160
|
+
|
|
153
161
|
type NormalizeReturn<
|
|
154
162
|
T,
|
|
155
163
|
V,
|
|
@@ -162,7 +170,7 @@ type NormalizeReturn<
|
|
|
162
170
|
? K extends keyof T
|
|
163
171
|
? NormalizeReturn<T[K], R>
|
|
164
172
|
: never
|
|
165
|
-
:
|
|
173
|
+
: StringIfPlural<keyof T>;
|
|
166
174
|
|
|
167
175
|
type NormalizeMultiReturn<T, V> = V extends `${infer N}:${infer R}`
|
|
168
176
|
? N extends keyof T
|
|
@@ -234,12 +242,12 @@ export interface TFunction<N extends Namespace = DefaultNamespace, TKPrefix = un
|
|
|
234
242
|
): TFuncReturn<N, TKeys, TDefaultResult, TKPrefix>;
|
|
235
243
|
}
|
|
236
244
|
|
|
237
|
-
export
|
|
245
|
+
export type TransProps<
|
|
238
246
|
K extends TFuncKey<N, TKPrefix> extends infer A ? A : never,
|
|
239
247
|
N extends Namespace = DefaultNamespace,
|
|
240
248
|
TKPrefix = undefined,
|
|
241
|
-
E
|
|
242
|
-
>
|
|
249
|
+
E = React.HTMLProps<HTMLDivElement>
|
|
250
|
+
> = E & {
|
|
243
251
|
children?: React.ReactNode;
|
|
244
252
|
components?: readonly React.ReactNode[] | { readonly [tagName: string]: React.ReactNode };
|
|
245
253
|
count?: number;
|
|
@@ -252,13 +260,13 @@ export interface TransProps<
|
|
|
252
260
|
values?: {};
|
|
253
261
|
shouldUnescape?: boolean;
|
|
254
262
|
t?: TFunction<N, TKPrefix>;
|
|
255
|
-
}
|
|
263
|
+
};
|
|
256
264
|
|
|
257
265
|
export function Trans<
|
|
258
266
|
K extends TFuncKey<N, TKPrefix> extends infer A ? A : never,
|
|
259
267
|
N extends Namespace = DefaultNamespace,
|
|
260
268
|
TKPrefix extends KeyPrefix<N> = undefined,
|
|
261
|
-
E
|
|
269
|
+
E = React.HTMLProps<HTMLDivElement>
|
|
262
270
|
>(props: TransProps<K, N, TKPrefix, E>): React.ReactElement;
|
|
263
271
|
|
|
264
272
|
export function useSSR(initialI18nStore: Resource, initialLanguage: string): void;
|
package/tslint.json
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
"defaultSeverity": "error",
|
|
3
3
|
"extends": "dtslint/dtslint.json",
|
|
4
4
|
"rules": {
|
|
5
|
-
"
|
|
5
|
+
"array-type": [true, "array"],
|
|
6
|
+
"no-empty-interface": false,
|
|
7
|
+
"no-redundant-jsdoc": false,
|
|
8
|
+
"no-unnecessary-generics": false,
|
|
9
|
+
"semicolon": false,
|
|
10
|
+
"strict-export-declare-modifiers": false
|
|
11
|
+
},
|
|
12
|
+
"linterOptions": {
|
|
13
|
+
"exclude": ["node_modules/**/*"]
|
|
6
14
|
}
|
|
7
15
|
}
|