react-i18next 11.0.0 β 11.0.1
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/.all-contributorsrc +0 -10
- package/CHANGELOG.md +4 -0
- package/README.md +13 -3
- package/package.json +4 -4
- package/src/index.d.ts +21 -21
- package/tsconfig.nonEsModuleInterop.json +1 -3
- package/.github/FUNDING.yml +0 -1
package/.all-contributorsrc
CHANGED
|
@@ -53,16 +53,6 @@
|
|
|
53
53
|
"question",
|
|
54
54
|
"code"
|
|
55
55
|
]
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"login": "schettino",
|
|
59
|
-
"name": "Matheus Schettino",
|
|
60
|
-
"avatar_url": "https://avatars0.githubusercontent.com/u/7825467?v=4",
|
|
61
|
-
"profile": "https://github.com/schettino",
|
|
62
|
-
"contributions": [
|
|
63
|
-
"code",
|
|
64
|
-
"question"
|
|
65
|
-
]
|
|
66
56
|
}
|
|
67
57
|
]
|
|
68
58
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
### 11.0.1
|
|
2
|
+
|
|
3
|
+
- typescript: Use updated ts export default from i18next [984](https://github.com/i18next/react-i18next/pull/984)
|
|
4
|
+
|
|
1
5
|
### 11.0.0
|
|
2
6
|
|
|
3
7
|
- **Breaking** based on i18next changes made in [v18.0.0](https://github.com/i18next/i18next/blob/master/CHANGELOG.md#1800) changing the language should not trigger a Suspense anylonger. The state will be ready and `t` bound to the previous language until `languageChanged` get triggered -> this results in a nicer experience for users (no flickering Suspense while changing the language). Based on issue "Suspence is fired during lang change when useTranslation called in between" [975](https://github.com/i18next/react-i18next/issues/975)
|
package/README.md
CHANGED
|
@@ -136,9 +136,19 @@ $ npm install react-i18next
|
|
|
136
136
|
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
|
|
137
137
|
|
|
138
138
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
139
|
-
<!-- prettier-ignore -->
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
<!-- prettier-ignore-start -->
|
|
140
|
+
<!-- markdownlint-disable -->
|
|
141
|
+
<table>
|
|
142
|
+
<tr>
|
|
143
|
+
<td align="center"><a href="http://twitter.com/jamuhl"><img src="https://avatars3.githubusercontent.com/u/977772?v=4" width="100px;" alt="Jan MΓΌhlemann"/><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>
|
|
144
|
+
<td align="center"><a href="http://twitter.com/#!/adrirai"><img src="https://avatars0.githubusercontent.com/u/1086194?v=4" width="100px;" alt="Adriano Raiano"/><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>
|
|
145
|
+
<td align="center"><a href="https://isaachinman.com"><img src="https://avatars1.githubusercontent.com/u/10575782?v=4" width="100px;" alt="Isaac Hinman"/><br /><sub><b>Isaac Hinman</b></sub></a><br /><a href="https://github.com/i18next/react-i18next/commits?author=isaachinman" title="Code">π»</a> <a href="#example-isaachinman" title="Examples">π‘</a> <a href="#question-isaachinman" title="Answering Questions">π¬</a></td>
|
|
146
|
+
<td align="center"><a href="http://www.alienfast.com"><img src="https://avatars1.githubusercontent.com/u/136564?v=4" width="100px;" alt="Kevin Ross"/><br /><sub><b>Kevin Ross</b></sub></a><br /><a href="#question-rosskevin" title="Answering Questions">π¬</a> <a href="https://github.com/i18next/react-i18next/commits?author=rosskevin" title="Code">π»</a></td>
|
|
147
|
+
</tr>
|
|
148
|
+
</table>
|
|
149
|
+
|
|
150
|
+
<!-- markdownlint-enable -->
|
|
151
|
+
<!-- prettier-ignore-end -->
|
|
142
152
|
|
|
143
153
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
144
154
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-i18next",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.1",
|
|
4
4
|
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.",
|
|
5
5
|
"main": "dist/commonjs/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"eslint-plugin-jsx-a11y": "6.2.3",
|
|
59
59
|
"eslint-plugin-react": "7.16.0",
|
|
60
60
|
"husky": "^3.0.3",
|
|
61
|
-
"i18next": "^
|
|
61
|
+
"i18next": "^19.0.0",
|
|
62
62
|
"jest": "24.8.0",
|
|
63
63
|
"jest-cli": "24.8.0",
|
|
64
64
|
"lint-staged": "^8.1.3",
|
|
@@ -76,11 +76,11 @@
|
|
|
76
76
|
"rollup-plugin-terser": "^5.1.1",
|
|
77
77
|
"sinon": "^7.2.3",
|
|
78
78
|
"tslint": "^5.13.1",
|
|
79
|
-
"typescript": "^3.
|
|
79
|
+
"typescript": "^3.6.4",
|
|
80
80
|
"yargs": "13.3.0"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
|
-
"i18next": ">=
|
|
83
|
+
"i18next": ">= 19.0.0",
|
|
84
84
|
"react": ">= 16.8.0"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
package/src/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import i18next, { ReactOptions, i18n, ThirdPartyModule, WithT, TFunction, Resource } from 'i18next';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
5
5
|
|
|
6
6
|
export type Namespace = string | string[];
|
|
7
7
|
|
|
8
|
-
export function setDefaults(options:
|
|
9
|
-
export function getDefaults():
|
|
10
|
-
export function setI18n(instance:
|
|
11
|
-
export function getI18n():
|
|
12
|
-
export const initReactI18next:
|
|
8
|
+
export function setDefaults(options: ReactOptions): void;
|
|
9
|
+
export function getDefaults(): ReactOptions;
|
|
10
|
+
export function setI18n(instance: i18n): void;
|
|
11
|
+
export function getI18n(): i18n;
|
|
12
|
+
export const initReactI18next: ThirdPartyModule;
|
|
13
13
|
export function composeInitialProps(ForComponent: any): (ctx: unknown) => Promise<any>;
|
|
14
14
|
export function getInitialProps(): {
|
|
15
15
|
initialI18nStore: {
|
|
@@ -29,30 +29,30 @@ declare module 'i18next' {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export interface TransProps extends Partial<
|
|
32
|
+
export interface TransProps extends Partial<WithT> {
|
|
33
33
|
children?: React.ReactNode;
|
|
34
34
|
components?: React.ReactNode[];
|
|
35
35
|
count?: number;
|
|
36
36
|
defaults?: string;
|
|
37
|
-
i18n?:
|
|
37
|
+
i18n?: i18n;
|
|
38
38
|
i18nKey?: string;
|
|
39
39
|
ns?: Namespace;
|
|
40
40
|
parent?: React.ReactNode;
|
|
41
41
|
tOptions?: {};
|
|
42
42
|
values?: {};
|
|
43
|
-
t?:
|
|
43
|
+
t?: TFunction;
|
|
44
44
|
}
|
|
45
45
|
export function Trans(props: TransProps): any;
|
|
46
46
|
|
|
47
47
|
export function useSSR(initialI18nStore: any, initialLanguage: any): void;
|
|
48
48
|
|
|
49
49
|
export interface UseTranslationOptions {
|
|
50
|
-
i18n?:
|
|
50
|
+
i18n?: i18n;
|
|
51
51
|
useSuspense?: boolean;
|
|
52
52
|
}
|
|
53
|
-
export type UseTranslationResponse = [
|
|
54
|
-
t:
|
|
55
|
-
i18n:
|
|
53
|
+
export type UseTranslationResponse = [TFunction, i18n, boolean] & {
|
|
54
|
+
t: TFunction;
|
|
55
|
+
i18n: i18n;
|
|
56
56
|
ready: boolean;
|
|
57
57
|
};
|
|
58
58
|
export function useTranslation(
|
|
@@ -69,14 +69,14 @@ export function withSSR(): <Props>(
|
|
|
69
69
|
initialLanguage,
|
|
70
70
|
...rest
|
|
71
71
|
}: {
|
|
72
|
-
initialI18nStore:
|
|
72
|
+
initialI18nStore: Resource;
|
|
73
73
|
initialLanguage: string;
|
|
74
74
|
} & Props): React.FunctionComponentElement<Props>;
|
|
75
75
|
getInitialProps: (ctx: unknown) => Promise<any>;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
export interface WithTranslation extends
|
|
79
|
-
i18n:
|
|
78
|
+
export interface WithTranslation extends WithT {
|
|
79
|
+
i18n: i18n;
|
|
80
80
|
tReady: boolean;
|
|
81
81
|
}
|
|
82
82
|
export function withTranslation(
|
|
@@ -89,22 +89,22 @@ export function withTranslation(
|
|
|
89
89
|
) => React.ComponentType<Omit<P, keyof WithTranslation>>;
|
|
90
90
|
|
|
91
91
|
export interface I18nextProviderProps {
|
|
92
|
-
i18n:
|
|
92
|
+
i18n: i18n;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
export const I18nextProvider: React.FunctionComponent<I18nextProviderProps>;
|
|
96
|
-
export const I18nContext: React.Context<
|
|
96
|
+
export const I18nContext: React.Context<i18n>;
|
|
97
97
|
|
|
98
98
|
export interface TranslationProps {
|
|
99
99
|
children: (
|
|
100
|
-
t:
|
|
100
|
+
t: TFunction,
|
|
101
101
|
options: {
|
|
102
|
-
i18n:
|
|
102
|
+
i18n: i18n;
|
|
103
103
|
lng: string;
|
|
104
104
|
},
|
|
105
105
|
) => React.ReactNode;
|
|
106
106
|
ns?: Namespace;
|
|
107
|
-
i18n?:
|
|
107
|
+
i18n?: i18n;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
export function Translation(props: TranslationProps): any;
|
package/.github/FUNDING.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
custom: https://locize.com
|