next-i18next 9.2.0 → 10.2.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 +5 -0
- package/dist/commonjs/appWithTranslation.js +4 -4
- package/dist/commonjs/config/createConfig.js +4 -4
- package/dist/commonjs/config/defaultConfig.js +1 -5
- package/dist/commonjs/createClient/browser.js +2 -2
- package/dist/commonjs/createClient/node.js +4 -4
- package/dist/commonjs/index.js +6 -0
- package/dist/commonjs/serverSideTranslations.js +4 -4
- package/dist/commonjs/types.js +6 -0
- package/dist/es/appWithTranslation.js +1 -3
- package/dist/es/config/createConfig.js +4 -8
- package/dist/es/config/defaultConfig.js +1 -3
- package/dist/es/createClient/browser.js +1 -3
- package/dist/es/createClient/node.js +2 -4
- package/dist/es/index.js +1 -1
- package/dist/es/serverSideTranslations.js +1 -1
- package/dist/es/types.js +2 -2
- package/dist/esm/appWithTranslation.js +2 -2
- package/dist/esm/config/createConfig.js +2 -2
- package/dist/esm/config/defaultConfig.js +1 -5
- package/dist/esm/createClient/node.js +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/serverSideTranslations.js +2 -2
- package/dist/esm/types.js +2 -2
- package/dist/types/config/defaultConfig.d.ts +0 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types.d.ts +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -260,6 +260,11 @@ To migrate from previous versions to the version 8, check out the [v8-migration
|
|
|
260
260
|
|
|
261
261
|
## Notes
|
|
262
262
|
|
|
263
|
+
### Vercel and Netlify
|
|
264
|
+
|
|
265
|
+
Some serverless PaaS may not be able to locate the path of your translations and require additional configuration. If you have filesystem issues using `serverSideTranslations`, set `config.localePath` to use `path.resolve`. An example can be [found here](https://github.com/isaachinman/next-i18next/issues/1552#issuecomment-981156476).
|
|
266
|
+
|
|
267
|
+
|
|
263
268
|
### Docker
|
|
264
269
|
|
|
265
270
|
For Docker deployment, note that if you use the `Dockerfile` from [Next.js docs](https://nextjs.org/docs/deployment#docker-image) do not forget to copy `next.config.js` and `next-i18next.config.js` into the Docker image.
|
|
@@ -6,6 +6,8 @@ require("core-js/modules/es.symbol.js");
|
|
|
6
6
|
|
|
7
7
|
require("core-js/modules/es.array.filter.js");
|
|
8
8
|
|
|
9
|
+
require("core-js/modules/es.object.to-string.js");
|
|
10
|
+
|
|
9
11
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
10
12
|
|
|
11
13
|
require("core-js/modules/es.array.for-each.js");
|
|
@@ -20,8 +22,6 @@ require("core-js/modules/es.object.define-property.js");
|
|
|
20
22
|
|
|
21
23
|
require("core-js/modules/es.array.iterator.js");
|
|
22
24
|
|
|
23
|
-
require("core-js/modules/es.object.to-string.js");
|
|
24
|
-
|
|
25
25
|
require("core-js/modules/es.string.iterator.js");
|
|
26
26
|
|
|
27
27
|
require("core-js/modules/es.weak-map.js");
|
|
@@ -75,9 +75,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
75
75
|
|
|
76
76
|
var __jsx = _react["default"].createElement;
|
|
77
77
|
|
|
78
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
78
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
79
79
|
|
|
80
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
80
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
81
81
|
|
|
82
82
|
var globalI18n = null;
|
|
83
83
|
exports.globalI18n = globalI18n;
|
|
@@ -33,6 +33,8 @@ exports.createConfig = void 0;
|
|
|
33
33
|
|
|
34
34
|
require("core-js/modules/es.array.some.js");
|
|
35
35
|
|
|
36
|
+
require("core-js/modules/es.object.to-string.js");
|
|
37
|
+
|
|
36
38
|
require("core-js/modules/es.regexp.exec.js");
|
|
37
39
|
|
|
38
40
|
require("core-js/modules/es.string.replace.js");
|
|
@@ -47,8 +49,6 @@ require("core-js/modules/es.string.iterator.js");
|
|
|
47
49
|
|
|
48
50
|
require("core-js/modules/es.array.iterator.js");
|
|
49
51
|
|
|
50
|
-
require("core-js/modules/es.object.to-string.js");
|
|
51
|
-
|
|
52
52
|
require("core-js/modules/es.set.js");
|
|
53
53
|
|
|
54
54
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
@@ -81,9 +81,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
81
81
|
|
|
82
82
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
83
83
|
|
|
84
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
84
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
85
85
|
|
|
86
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
86
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
87
87
|
|
|
88
88
|
var deepMergeObjects = ['backend', 'detection'];
|
|
89
89
|
|
|
@@ -25,11 +25,7 @@ var defaultConfig = {
|
|
|
25
25
|
},
|
|
26
26
|
|
|
27
27
|
interpolation: {
|
|
28
|
-
escapeValue: false
|
|
29
|
-
format: function format(value, _format) {
|
|
30
|
-
return _format === 'uppercase' ? value.toUpperCase() : value;
|
|
31
|
-
},
|
|
32
|
-
formatSeparator: ','
|
|
28
|
+
escapeValue: false
|
|
33
29
|
},
|
|
34
30
|
load: 'currentOnly',
|
|
35
31
|
localeExtension: LOCALE_EXTENSION,
|
|
@@ -11,10 +11,10 @@ exports["default"] = void 0;
|
|
|
11
11
|
|
|
12
12
|
require("core-js/modules/es.array.for-each.js");
|
|
13
13
|
|
|
14
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
15
|
-
|
|
16
14
|
require("core-js/modules/es.object.to-string.js");
|
|
17
15
|
|
|
16
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
17
|
+
|
|
18
18
|
require("core-js/modules/es.promise.js");
|
|
19
19
|
|
|
20
20
|
var _i18next = _interopRequireDefault(require("i18next"));
|
|
@@ -23,12 +23,12 @@ exports["default"] = void 0;
|
|
|
23
23
|
|
|
24
24
|
require("core-js/modules/es.array.some.js");
|
|
25
25
|
|
|
26
|
+
require("core-js/modules/es.object.to-string.js");
|
|
27
|
+
|
|
26
28
|
require("core-js/modules/es.array.for-each.js");
|
|
27
29
|
|
|
28
30
|
require("core-js/modules/web.dom-collections.for-each.js");
|
|
29
31
|
|
|
30
|
-
require("core-js/modules/es.object.to-string.js");
|
|
31
|
-
|
|
32
32
|
require("core-js/modules/es.promise.js");
|
|
33
33
|
|
|
34
34
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -37,9 +37,9 @@ var _i18next = _interopRequireDefault(require("i18next"));
|
|
|
37
37
|
|
|
38
38
|
var _i18nextFsBackend = _interopRequireDefault(require("i18next-fs-backend"));
|
|
39
39
|
|
|
40
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
40
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
41
|
|
|
42
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
42
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
43
43
|
|
|
44
44
|
var globalInstance;
|
|
45
45
|
|
package/dist/commonjs/index.js
CHANGED
|
@@ -17,6 +17,12 @@ Object.defineProperty(exports, "Trans", {
|
|
|
17
17
|
return _reactI18next.Trans;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
+
Object.defineProperty(exports, "Translation", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _reactI18next.Translation;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
20
26
|
Object.defineProperty(exports, "useTranslation", {
|
|
21
27
|
enumerable: true,
|
|
22
28
|
get: function get() {
|
|
@@ -45,6 +45,8 @@ require("core-js/modules/es.array.is-array.js");
|
|
|
45
45
|
|
|
46
46
|
require("core-js/modules/es.array.reduce.js");
|
|
47
47
|
|
|
48
|
+
require("core-js/modules/es.object.to-string.js");
|
|
49
|
+
|
|
48
50
|
require("core-js/modules/es.object.values.js");
|
|
49
51
|
|
|
50
52
|
require("core-js/modules/es.array.concat.js");
|
|
@@ -55,8 +57,6 @@ require("core-js/modules/es.string.iterator.js");
|
|
|
55
57
|
|
|
56
58
|
require("core-js/modules/es.array.iterator.js");
|
|
57
59
|
|
|
58
|
-
require("core-js/modules/es.object.to-string.js");
|
|
59
|
-
|
|
60
60
|
require("core-js/modules/es.set.js");
|
|
61
61
|
|
|
62
62
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
@@ -85,9 +85,9 @@ var _createClient2 = _interopRequireDefault(require("./createClient"));
|
|
|
85
85
|
|
|
86
86
|
var _appWithTranslation = require("./appWithTranslation");
|
|
87
87
|
|
|
88
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
88
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
89
89
|
|
|
90
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
90
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
91
91
|
|
|
92
92
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
93
93
|
|
package/dist/commonjs/types.js
CHANGED
|
@@ -41,6 +41,12 @@ Object.defineProperty(exports, "DefaultNamespace", {
|
|
|
41
41
|
return _reactI18next.DefaultNamespace;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
+
Object.defineProperty(exports, "Translation", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function get() {
|
|
47
|
+
return _reactI18next.Translation;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
44
50
|
Object.defineProperty(exports, "appWithTranslation", {
|
|
45
51
|
enumerable: true,
|
|
46
52
|
get: function get() {
|
|
@@ -17,8 +17,6 @@ export const appWithTranslation = (WrappedComponent, configOverride = null) => {
|
|
|
17
17
|
// 2. Router locale changes
|
|
18
18
|
|
|
19
19
|
const i18n = useMemo(() => {
|
|
20
|
-
var _userConfig;
|
|
21
|
-
|
|
22
20
|
if (!_nextI18Next) return null;
|
|
23
21
|
let {
|
|
24
22
|
userConfig
|
|
@@ -37,7 +35,7 @@ export const appWithTranslation = (WrappedComponent, configOverride = null) => {
|
|
|
37
35
|
userConfig = configOverride;
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
if (!
|
|
38
|
+
if (!userConfig?.i18n) {
|
|
41
39
|
throw new Error('appWithTranslation was called without config.i18n');
|
|
42
40
|
}
|
|
43
41
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { defaultConfig } from './defaultConfig';
|
|
2
2
|
const deepMergeObjects = ['backend', 'detection'];
|
|
3
3
|
export const createConfig = userConfig => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (typeof (userConfig === null || userConfig === void 0 ? void 0 : userConfig.lng) !== 'string') {
|
|
4
|
+
if (typeof userConfig?.lng !== 'string') {
|
|
7
5
|
throw new Error('config.lng was not passed into createConfig');
|
|
8
6
|
} //
|
|
9
7
|
// Initial merge of default and user-provided config
|
|
@@ -44,7 +42,7 @@ export const createConfig = userConfig => {
|
|
|
44
42
|
combinedConfig.fallbackLng = combinedConfig.defaultLocale;
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
const hasCustomBackend = userConfig
|
|
45
|
+
const hasCustomBackend = userConfig?.use?.some(b => b.type === 'backend');
|
|
48
46
|
|
|
49
47
|
if (!process.browser && typeof window === 'undefined') {
|
|
50
48
|
combinedConfig.preload = locales;
|
|
@@ -60,10 +58,8 @@ export const createConfig = userConfig => {
|
|
|
60
58
|
//
|
|
61
59
|
|
|
62
60
|
if (typeof defaultNS === 'string' && typeof lng !== 'undefined') {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const prefix = (userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$interpola = userConfig.interpolation) === null || _userConfig$interpola === void 0 ? void 0 : _userConfig$interpola.prefix) ?? '{{';
|
|
66
|
-
const suffix = (userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$interpola2 = userConfig.interpolation) === null || _userConfig$interpola2 === void 0 ? void 0 : _userConfig$interpola2.suffix) ?? '}}';
|
|
61
|
+
const prefix = userConfig?.interpolation?.prefix ?? '{{';
|
|
62
|
+
const suffix = userConfig?.interpolation?.suffix ?? '}}';
|
|
67
63
|
const defaultLocaleStructure = localeStructure.replace(`${prefix}lng${suffix}`, lng).replace(`${prefix}ns${suffix}`, defaultNS);
|
|
68
64
|
const defaultFile = `/${defaultLocaleStructure}.${localeExtension}`;
|
|
69
65
|
const defaultNSPath = path.join(localePath, defaultFile);
|
|
@@ -17,9 +17,7 @@ export const defaultConfig = {
|
|
|
17
17
|
},
|
|
18
18
|
|
|
19
19
|
interpolation: {
|
|
20
|
-
escapeValue: false
|
|
21
|
-
format: (value, format) => format === 'uppercase' ? value.toUpperCase() : value,
|
|
22
|
-
formatSeparator: ','
|
|
20
|
+
escapeValue: false
|
|
23
21
|
},
|
|
24
22
|
load: 'currentOnly',
|
|
25
23
|
localeExtension: LOCALE_EXTENSION,
|
|
@@ -4,9 +4,7 @@ export default (config => {
|
|
|
4
4
|
let initPromise;
|
|
5
5
|
|
|
6
6
|
if (!instance.isInitialized) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
config === null || config === void 0 ? void 0 : (_config$use = config.use) === null || _config$use === void 0 ? void 0 : _config$use.forEach(x => instance.use(x));
|
|
7
|
+
config?.use?.forEach(x => instance.use(x));
|
|
10
8
|
initPromise = instance.init(config);
|
|
11
9
|
} else {
|
|
12
10
|
initPromise = Promise.resolve(i18n.t);
|
|
@@ -16,15 +16,13 @@ export default (config => {
|
|
|
16
16
|
let initPromise;
|
|
17
17
|
|
|
18
18
|
if (!instance.isInitialized) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const hasCustomBackend = config === null || config === void 0 ? void 0 : (_config$use = config.use) === null || _config$use === void 0 ? void 0 : _config$use.some(b => b.type === 'backend');
|
|
19
|
+
const hasCustomBackend = config?.use?.some(b => b.type === 'backend');
|
|
22
20
|
|
|
23
21
|
if (!hasCustomBackend) {
|
|
24
22
|
instance.use(i18nextFSBackend);
|
|
25
23
|
}
|
|
26
24
|
|
|
27
|
-
config
|
|
25
|
+
config?.use?.forEach(x => instance.use(x));
|
|
28
26
|
initPromise = instance.init(config);
|
|
29
27
|
} else {
|
|
30
28
|
initPromise = Promise.resolve(i18n.t);
|
package/dist/es/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { I18nContext, Trans, useTranslation, withTranslation } from 'react-i18next';
|
|
1
|
+
export { I18nContext, Trans, Translation, useTranslation, withTranslation } from 'react-i18next';
|
|
2
2
|
export { appWithTranslation, globalI18n as i18n } from './appWithTranslation';
|
|
@@ -57,7 +57,7 @@ export const serverSideTranslations = async (initialLocale, namespacesRequired =
|
|
|
57
57
|
} = config;
|
|
58
58
|
|
|
59
59
|
if (reloadOnPrerender) {
|
|
60
|
-
await
|
|
60
|
+
await globalI18n?.reloadResources();
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
const {
|
package/dist/es/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* tslint:disable no-explicit-any */
|
|
2
|
-
import { I18nContext, useTranslation, Trans, withTranslation, Resources, DefaultNamespace } from 'react-i18next';
|
|
2
|
+
import { I18nContext, useTranslation, Trans, withTranslation, Resources, DefaultNamespace, Translation } from 'react-i18next';
|
|
3
3
|
import { appWithTranslation, i18n } from './';
|
|
4
|
-
export { i18n, I18nContext, appWithTranslation, useTranslation, Trans, withTranslation, Resources, DefaultNamespace };
|
|
4
|
+
export { i18n, I18nContext, appWithTranslation, useTranslation, Trans, Translation, withTranslation, Resources, DefaultNamespace };
|
|
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
var __jsx = React.createElement;
|
|
4
4
|
|
|
5
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
6
|
|
|
7
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
8
|
|
|
9
9
|
import React, { useMemo } from 'react';
|
|
10
10
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
@@ -9,9 +9,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
9
9
|
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
11
11
|
|
|
12
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
13
|
|
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
15
|
|
|
16
16
|
import { defaultConfig } from './defaultConfig';
|
|
17
17
|
var deepMergeObjects = ['backend', 'detection'];
|
|
@@ -17,11 +17,7 @@ export var defaultConfig = {
|
|
|
17
17
|
},
|
|
18
18
|
|
|
19
19
|
interpolation: {
|
|
20
|
-
escapeValue: false
|
|
21
|
-
format: function format(value, _format) {
|
|
22
|
-
return _format === 'uppercase' ? value.toUpperCase() : value;
|
|
23
|
-
},
|
|
24
|
-
formatSeparator: ','
|
|
20
|
+
escapeValue: false
|
|
25
21
|
},
|
|
26
22
|
load: 'currentOnly',
|
|
27
23
|
localeExtension: LOCALE_EXTENSION,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
4
|
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
|
|
7
7
|
import i18n from 'i18next';
|
|
8
8
|
import i18nextFSBackend from 'i18next-fs-backend';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { I18nContext, Trans, useTranslation, withTranslation } from 'react-i18next';
|
|
1
|
+
export { I18nContext, Trans, Translation, useTranslation, withTranslation } from 'react-i18next';
|
|
2
2
|
export { appWithTranslation, globalI18n as i18n } from './appWithTranslation';
|
|
@@ -4,9 +4,9 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
5
5
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
6
6
|
|
|
7
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
8
|
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
10
|
|
|
11
11
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
12
12
|
|
package/dist/esm/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* tslint:disable no-explicit-any */
|
|
2
|
-
import { I18nContext, useTranslation, Trans, withTranslation, Resources, DefaultNamespace } from 'react-i18next';
|
|
2
|
+
import { I18nContext, useTranslation, Trans, withTranslation, Resources, DefaultNamespace, Translation } from 'react-i18next';
|
|
3
3
|
import { appWithTranslation, i18n } from './';
|
|
4
|
-
export { i18n, I18nContext, appWithTranslation, useTranslation, Trans, withTranslation, Resources, DefaultNamespace };
|
|
4
|
+
export { i18n, I18nContext, appWithTranslation, useTranslation, Trans, Translation, withTranslation, Resources, DefaultNamespace };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { I18nContext, Trans, useTranslation, withTranslation } from 'react-i18next';
|
|
1
|
+
export { I18nContext, Trans, Translation, useTranslation, withTranslation } from 'react-i18next';
|
|
2
2
|
export { appWithTranslation, globalI18n as i18n } from './appWithTranslation';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I18nContext, useTranslation, Trans, withTranslation, WithTranslation as ReactI18nextWithTranslation, Resources, DefaultNamespace } from 'react-i18next';
|
|
1
|
+
import { I18nContext, useTranslation, Trans, withTranslation, WithTranslation as ReactI18nextWithTranslation, Resources, DefaultNamespace, Translation } from 'react-i18next';
|
|
2
2
|
import { InitOptions, i18n as I18NextClient, TFunction as I18NextTFunction } from 'i18next';
|
|
3
3
|
import { appWithTranslation, i18n } from './';
|
|
4
4
|
declare type NextJsI18NConfig = {
|
|
@@ -40,4 +40,4 @@ export declare type SSRConfig = {
|
|
|
40
40
|
userConfig: UserConfig | null;
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
|
-
export { i18n, I18nContext, appWithTranslation, useTranslation, Trans, withTranslation, Resources, DefaultNamespace, };
|
|
43
|
+
export { i18n, I18nContext, appWithTranslation, useTranslation, Trans, Translation, withTranslation, Resources, DefaultNamespace, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-i18next",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"repository": "git@github.com:isaachinman/next-i18next.git",
|
|
5
5
|
"author": "Isaac Hinman <isaac@isaachinman.com>",
|
|
6
6
|
"funding": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"run-example": "yarn build && cd examples/simple && yarn && yarn dev",
|
|
40
40
|
"run-example:prod": "yarn build:examples/simple && yarn --cwd examples/simple start",
|
|
41
41
|
"run-cypress": "cypress run --config-file cypress/cypress.json",
|
|
42
|
-
"test": "yarn check-types && yarn clean && yarn build && yarn build:examples/simple && bundlesize && NODE_ENV=test jest --
|
|
42
|
+
"test": "yarn check-types && yarn clean && yarn build && yarn build:examples/simple && bundlesize && NODE_ENV=test jest --maxWorkers=1 --silent",
|
|
43
43
|
"test:e2e": "start-server-and-test 'yarn --cwd examples/simple start' 3000 'yarn run-cypress'",
|
|
44
44
|
"contributors:check": "all-contributors check",
|
|
45
45
|
"contributors:add": "all-contributors add",
|
|
@@ -86,14 +86,14 @@
|
|
|
86
86
|
"babel-plugin-add-module-exports": "^1.0.0",
|
|
87
87
|
"babel-plugin-transform-async-to-generator": "^6.24.1",
|
|
88
88
|
"bundlesize": "^0.18.0",
|
|
89
|
-
"cypress": "^
|
|
89
|
+
"cypress": "^9.1.1",
|
|
90
90
|
"eslint": "^7.17.0",
|
|
91
91
|
"eslint-plugin-cypress": "^2.11.2",
|
|
92
92
|
"eslint-plugin-import": "^2.22.1",
|
|
93
93
|
"eslint-plugin-jest": "^24.1.5",
|
|
94
94
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
95
95
|
"eslint-plugin-react": "^7.22.0",
|
|
96
|
-
"eslint-plugin-typescript-sort-keys": "^1.
|
|
96
|
+
"eslint-plugin-typescript-sort-keys": "^2.1.0",
|
|
97
97
|
"husky": "^3.0.0",
|
|
98
98
|
"jest": "^26.6.3",
|
|
99
99
|
"next": "^10.0.4",
|