next-i18next 12.0.1 → 12.1.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/README.md +1 -0
- package/dist/commonjs/appWithTranslation.js +1 -3
- package/dist/commonjs/createClient/browser.js +5 -0
- package/dist/commonjs/createClient/node.js +5 -0
- package/dist/es/appWithTranslation.js +1 -3
- package/dist/es/createClient/browser.js +5 -0
- package/dist/es/createClient/node.js +5 -0
- package/dist/esm/appWithTranslation.js +1 -3
- package/dist/esm/createClient/browser.js +5 -0
- package/dist/esm/createClient/node.js +5 -0
- package/dist/types/types.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -291,6 +291,7 @@ This option will reload your translations whenever `serverSideTranslations` is c
|
|
|
291
291
|
| `reloadOnPrerender` | `false` | |
|
|
292
292
|
| `serializeConfig` | `true` | |
|
|
293
293
|
| `use` (for plugins) | `[]` | |
|
|
294
|
+
| `onPreInitI18next` | `undefined` | i.e. `(i18n) => i18n.on('failedLoading', handleFailedLoading)` |
|
|
294
295
|
|
|
295
296
|
`localePath` as a function is of the form `(locale: string, namespace: string, missing: boolean) => string` returning the entire path including filename and extension. When `missing` is true, return the path for the `addPath` option of `i18next-fs-backend`, when false, return the path for the `loadPath` option. [More info at the `i18next-fs-backend` repo.](https://github.com/i18next/i18next-fs-backend/tree/master#backend-options)
|
|
296
297
|
|
|
@@ -135,9 +135,7 @@ var appWithTranslation = function appWithTranslation(WrappedComponent) {
|
|
|
135
135
|
}, [_nextI18Next, locale, configOverride, ns]);
|
|
136
136
|
return i18n !== null ? __jsx(_reactI18next.I18nextProvider, {
|
|
137
137
|
i18n: i18n
|
|
138
|
-
}, __jsx(WrappedComponent, (0, _extends2["default"])({
|
|
139
|
-
key: locale
|
|
140
|
-
}, props))) : __jsx(WrappedComponent, (0, _extends2["default"])({
|
|
138
|
+
}, __jsx(WrappedComponent, props)) : __jsx(WrappedComponent, (0, _extends2["default"])({
|
|
141
139
|
key: locale
|
|
142
140
|
}, props));
|
|
143
141
|
};
|
|
@@ -32,6 +32,11 @@ var _default = function _default(config) {
|
|
|
32
32
|
config === null || config === void 0 ? void 0 : (_config$use = config.use) === null || _config$use === void 0 ? void 0 : _config$use.forEach(function (x) {
|
|
33
33
|
return instance.use(x);
|
|
34
34
|
});
|
|
35
|
+
|
|
36
|
+
if (typeof config.onPreInitI18next === 'function') {
|
|
37
|
+
config.onPreInitI18next(instance);
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
initPromise = instance.init(config);
|
|
36
41
|
} else {
|
|
37
42
|
initPromise = Promise.resolve(_i18next["default"].t);
|
|
@@ -72,6 +72,11 @@ var _default = function _default(config) {
|
|
|
72
72
|
config === null || config === void 0 ? void 0 : (_config$use2 = config.use) === null || _config$use2 === void 0 ? void 0 : _config$use2.forEach(function (x) {
|
|
73
73
|
return instance.use(x);
|
|
74
74
|
});
|
|
75
|
+
|
|
76
|
+
if (typeof config.onPreInitI18next === 'function') {
|
|
77
|
+
config.onPreInitI18next(instance);
|
|
78
|
+
}
|
|
79
|
+
|
|
75
80
|
initPromise = instance.init(config);
|
|
76
81
|
} else {
|
|
77
82
|
initPromise = Promise.resolve(_i18next["default"].t);
|
|
@@ -55,9 +55,7 @@ export const appWithTranslation = (WrappedComponent, configOverride = null) => {
|
|
|
55
55
|
}, [_nextI18Next, locale, configOverride, ns]);
|
|
56
56
|
return i18n !== null ? /*#__PURE__*/React.createElement(I18nextProvider, {
|
|
57
57
|
i18n: i18n
|
|
58
|
-
}, /*#__PURE__*/React.createElement(WrappedComponent, _extends({
|
|
59
|
-
key: locale
|
|
60
|
-
}, props))) : /*#__PURE__*/React.createElement(WrappedComponent, _extends({
|
|
58
|
+
}, /*#__PURE__*/React.createElement(WrappedComponent, props)) : /*#__PURE__*/React.createElement(WrappedComponent, _extends({
|
|
61
59
|
key: locale
|
|
62
60
|
}, props));
|
|
63
61
|
};
|
|
@@ -6,6 +6,11 @@ export default (config => {
|
|
|
6
6
|
|
|
7
7
|
if (!instance.isInitialized) {
|
|
8
8
|
config?.use?.forEach(x => instance.use(x));
|
|
9
|
+
|
|
10
|
+
if (typeof config.onPreInitI18next === 'function') {
|
|
11
|
+
config.onPreInitI18next(instance);
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
initPromise = instance.init(config);
|
|
10
15
|
} else {
|
|
11
16
|
initPromise = Promise.resolve(i18n.t);
|
|
@@ -24,6 +24,11 @@ export default (config => {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
config?.use?.forEach(x => instance.use(x));
|
|
27
|
+
|
|
28
|
+
if (typeof config.onPreInitI18next === 'function') {
|
|
29
|
+
config.onPreInitI18next(instance);
|
|
30
|
+
}
|
|
31
|
+
|
|
27
32
|
initPromise = instance.init(config);
|
|
28
33
|
} else {
|
|
29
34
|
initPromise = Promise.resolve(i18n.t);
|
|
@@ -66,9 +66,7 @@ export var appWithTranslation = function appWithTranslation(WrappedComponent) {
|
|
|
66
66
|
}, [_nextI18Next, locale, configOverride, ns]);
|
|
67
67
|
return i18n !== null ? __jsx(I18nextProvider, {
|
|
68
68
|
i18n: i18n
|
|
69
|
-
}, __jsx(WrappedComponent, _extends({
|
|
70
|
-
key: locale
|
|
71
|
-
}, props))) : __jsx(WrappedComponent, _extends({
|
|
69
|
+
}, __jsx(WrappedComponent, props)) : __jsx(WrappedComponent, _extends({
|
|
72
70
|
key: locale
|
|
73
71
|
}, props));
|
|
74
72
|
};
|
|
@@ -10,6 +10,11 @@ export default (function (config) {
|
|
|
10
10
|
config === null || config === void 0 ? void 0 : (_config$use = config.use) === null || _config$use === void 0 ? void 0 : _config$use.forEach(function (x) {
|
|
11
11
|
return instance.use(x);
|
|
12
12
|
});
|
|
13
|
+
|
|
14
|
+
if (typeof config.onPreInitI18next === 'function') {
|
|
15
|
+
config.onPreInitI18next(instance);
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
initPromise = instance.init(config);
|
|
14
19
|
} else {
|
|
15
20
|
initPromise = Promise.resolve(i18n.t);
|
|
@@ -36,6 +36,11 @@ export default (function (config) {
|
|
|
36
36
|
config === null || config === void 0 ? void 0 : (_config$use2 = config.use) === null || _config$use2 === void 0 ? void 0 : _config$use2.forEach(function (x) {
|
|
37
37
|
return instance.use(x);
|
|
38
38
|
});
|
|
39
|
+
|
|
40
|
+
if (typeof config.onPreInitI18next === 'function') {
|
|
41
|
+
config.onPreInitI18next(instance);
|
|
42
|
+
}
|
|
43
|
+
|
|
39
44
|
initPromise = instance.init(config);
|
|
40
45
|
} else {
|
|
41
46
|
initPromise = Promise.resolve(i18n.t);
|
package/dist/types/types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare type UserConfig = {
|
|
|
10
10
|
localeExtension?: string;
|
|
11
11
|
localePath?: string | ((locale: string, namespace: string, missing: boolean) => string);
|
|
12
12
|
localeStructure?: string;
|
|
13
|
+
onPreInitI18next?: (i18n: I18n) => void;
|
|
13
14
|
reloadOnPrerender?: boolean;
|
|
14
15
|
serializeConfig?: boolean;
|
|
15
16
|
use?: any[];
|