next-i18next 8.10.0 → 9.0.0
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/dist/commonjs/appWithTranslation.js +7 -4
- package/dist/commonjs/serverSideTranslations.js +1 -0
- package/dist/es/appWithTranslation.js +5 -5
- package/dist/es/serverSideTranslations.js +1 -0
- package/dist/esm/appWithTranslation.js +7 -4
- package/dist/esm/serverSideTranslations.js +1 -0
- package/dist/types/appWithTranslation.d.ts +1 -1
- package/dist/types/types.d.ts +1 -0
- package/package.json +3 -3
|
@@ -86,17 +86,20 @@ var appWithTranslation = function appWithTranslation(WrappedComponent) {
|
|
|
86
86
|
var configOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
87
87
|
|
|
88
88
|
var AppWithTranslation = function AppWithTranslation(props) {
|
|
89
|
-
var
|
|
90
|
-
|
|
89
|
+
var _ref = props.pageProps,
|
|
90
|
+
_nextI18Next = _ref._nextI18Next;
|
|
91
|
+
var locale = null; // Memoize the instance and only re-initialize when either:
|
|
91
92
|
// 1. The route changes (non-shallowly)
|
|
92
93
|
// 2. Router locale changes
|
|
93
94
|
|
|
94
95
|
var i18n = (0, _react.useMemo)(function () {
|
|
95
96
|
var _userConfig;
|
|
96
97
|
|
|
97
|
-
if (!
|
|
98
|
+
if (!_nextI18Next) return null;
|
|
98
99
|
var userConfig = _nextI18Next.userConfig;
|
|
99
|
-
var initialI18nStore = _nextI18Next.initialI18nStore
|
|
100
|
+
var initialI18nStore = _nextI18Next.initialI18nStore,
|
|
101
|
+
initialLocale = _nextI18Next.initialLocale;
|
|
102
|
+
locale = initialLocale;
|
|
100
103
|
|
|
101
104
|
if (userConfig === null && configOverride === null) {
|
|
102
105
|
throw new Error('appWithTranslation was called without a next-i18next config');
|
|
@@ -243,6 +243,7 @@ var serverSideTranslations = /*#__PURE__*/function () {
|
|
|
243
243
|
return _context.abrupt("return", {
|
|
244
244
|
_nextI18Next: {
|
|
245
245
|
initialI18nStore: initialI18nStore,
|
|
246
|
+
initialLocale: initialLocale,
|
|
246
247
|
userConfig: config.serializeConfig ? userConfig : null
|
|
247
248
|
}
|
|
248
249
|
});
|
|
@@ -12,22 +12,22 @@ export const appWithTranslation = (WrappedComponent, configOverride = null) => {
|
|
|
12
12
|
const {
|
|
13
13
|
_nextI18Next
|
|
14
14
|
} = props.pageProps;
|
|
15
|
-
|
|
16
|
-
locale
|
|
17
|
-
} = props.router; // Memoize the instance and only re-initialize when either:
|
|
15
|
+
let locale = null; // Memoize the instance and only re-initialize when either:
|
|
18
16
|
// 1. The route changes (non-shallowly)
|
|
19
17
|
// 2. Router locale changes
|
|
20
18
|
|
|
21
19
|
const i18n = useMemo(() => {
|
|
22
20
|
var _userConfig;
|
|
23
21
|
|
|
24
|
-
if (!
|
|
22
|
+
if (!_nextI18Next) return null;
|
|
25
23
|
let {
|
|
26
24
|
userConfig
|
|
27
25
|
} = _nextI18Next;
|
|
28
26
|
const {
|
|
29
|
-
initialI18nStore
|
|
27
|
+
initialI18nStore,
|
|
28
|
+
initialLocale
|
|
30
29
|
} = _nextI18Next;
|
|
30
|
+
locale = initialLocale;
|
|
31
31
|
|
|
32
32
|
if (userConfig === null && configOverride === null) {
|
|
33
33
|
throw new Error('appWithTranslation was called without a next-i18next config');
|
|
@@ -17,17 +17,20 @@ export var appWithTranslation = function appWithTranslation(WrappedComponent) {
|
|
|
17
17
|
var configOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
18
18
|
|
|
19
19
|
var AppWithTranslation = function AppWithTranslation(props) {
|
|
20
|
-
var
|
|
21
|
-
|
|
20
|
+
var _ref = props.pageProps,
|
|
21
|
+
_nextI18Next = _ref._nextI18Next;
|
|
22
|
+
var locale = null; // Memoize the instance and only re-initialize when either:
|
|
22
23
|
// 1. The route changes (non-shallowly)
|
|
23
24
|
// 2. Router locale changes
|
|
24
25
|
|
|
25
26
|
var i18n = useMemo(function () {
|
|
26
27
|
var _userConfig;
|
|
27
28
|
|
|
28
|
-
if (!
|
|
29
|
+
if (!_nextI18Next) return null;
|
|
29
30
|
var userConfig = _nextI18Next.userConfig;
|
|
30
|
-
var initialI18nStore = _nextI18Next.initialI18nStore
|
|
31
|
+
var initialI18nStore = _nextI18Next.initialI18nStore,
|
|
32
|
+
initialLocale = _nextI18Next.initialLocale;
|
|
33
|
+
locale = initialLocale;
|
|
31
34
|
|
|
32
35
|
if (userConfig === null && configOverride === null) {
|
|
33
36
|
throw new Error('appWithTranslation was called without a next-i18next config');
|
|
@@ -161,6 +161,7 @@ export var serverSideTranslations = /*#__PURE__*/function () {
|
|
|
161
161
|
return _context.abrupt("return", {
|
|
162
162
|
_nextI18Next: {
|
|
163
163
|
initialI18nStore: initialI18nStore,
|
|
164
|
+
initialLocale: initialLocale,
|
|
164
165
|
userConfig: config.serializeConfig ? userConfig : null
|
|
165
166
|
}
|
|
166
167
|
});
|
|
@@ -8,4 +8,4 @@ declare type AppProps = NextJsAppProps & {
|
|
|
8
8
|
pageProps: SSRConfig;
|
|
9
9
|
};
|
|
10
10
|
export declare let globalI18n: I18NextClient | null;
|
|
11
|
-
export declare const appWithTranslation: (WrappedComponent: React.ComponentType<
|
|
11
|
+
export declare const appWithTranslation: <Props extends AppProps = AppProps>(WrappedComponent: React.ComponentType<Props>, configOverride?: UserConfig | null) => ((props: Props) => JSX.Element) & hoistNonReactStatics.NonReactStatics<React.ComponentType<Props>, {}>;
|
package/dist/types/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-i18next",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"repository": "git@github.com:isaachinman/next-i18next.git",
|
|
5
5
|
"author": "Isaac Hinman <isaac@isaachinman.com>",
|
|
6
6
|
"funding": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"types": "dist/types/types.d.ts",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"engines": {
|
|
15
|
-
"node": ">=
|
|
15
|
+
"node": ">=12"
|
|
16
16
|
},
|
|
17
17
|
"description": "The easiest way to translate your NextJs apps.",
|
|
18
18
|
"keywords": [
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
108
108
|
"core-js": "^3",
|
|
109
109
|
"hoist-non-react-statics": "^3.2.0",
|
|
110
|
-
"i18next": "^
|
|
110
|
+
"i18next": "^21.4.1",
|
|
111
111
|
"i18next-fs-backend": "^1.0.7",
|
|
112
112
|
"react-i18next": "^11.8.13"
|
|
113
113
|
},
|