next-i18next 13.2.1 → 13.2.2
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.
|
@@ -56,7 +56,8 @@ var appWithTranslation = function appWithTranslation(WrappedComponent) {
|
|
|
56
56
|
var configOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
57
57
|
var AppWithTranslation = function AppWithTranslation(props) {
|
|
58
58
|
var _nextI18Next$initialL, _props$router;
|
|
59
|
-
var
|
|
59
|
+
var _ref = props.pageProps || {},
|
|
60
|
+
_nextI18Next = _ref._nextI18Next; // pageProps may be undefined on strange setups, i.e. https://github.com/i18next/next-i18next/issues/2109
|
|
60
61
|
var locale = (_nextI18Next$initialL = _nextI18Next === null || _nextI18Next === void 0 ? void 0 : _nextI18Next.initialLocale) !== null && _nextI18Next$initialL !== void 0 ? _nextI18Next$initialL : props === null || props === void 0 ? void 0 : (_props$router = props.router) === null || _props$router === void 0 ? void 0 : _props$router.locale;
|
|
61
62
|
var ns = _nextI18Next === null || _nextI18Next === void 0 ? void 0 : _nextI18Next.ns;
|
|
62
63
|
|
|
@@ -77,8 +78,8 @@ var appWithTranslation = function appWithTranslation(WrappedComponent) {
|
|
|
77
78
|
if (!(userConfig !== null && userConfig !== void 0 && (_userConfig$i18n = userConfig.i18n) !== null && _userConfig$i18n !== void 0 && _userConfig$i18n.defaultLocale)) {
|
|
78
79
|
throw new Error('config.i18n does not include a defaultLocale property');
|
|
79
80
|
}
|
|
80
|
-
var
|
|
81
|
-
initialI18nStore =
|
|
81
|
+
var _ref2 = _nextI18Next || {},
|
|
82
|
+
initialI18nStore = _ref2.initialI18nStore;
|
|
82
83
|
var resources = configOverride !== null && configOverride !== void 0 && configOverride.resources ? configOverride.resources : initialI18nStore;
|
|
83
84
|
if (!locale) locale = userConfig.i18n.defaultLocale;
|
|
84
85
|
var instance = (0, _createClient["default"])(_objectSpread(_objectSpread({}, (0, _createConfig.createConfig)(_objectSpread(_objectSpread({}, userConfig), {}, {
|
|
@@ -10,7 +10,7 @@ export const appWithTranslation = (WrappedComponent, configOverride = null) => {
|
|
|
10
10
|
const AppWithTranslation = props => {
|
|
11
11
|
const {
|
|
12
12
|
_nextI18Next
|
|
13
|
-
} = props.pageProps;
|
|
13
|
+
} = props.pageProps || {}; // pageProps may be undefined on strange setups, i.e. https://github.com/i18next/next-i18next/issues/2109
|
|
14
14
|
let locale = _nextI18Next?.initialLocale ?? props?.router?.locale;
|
|
15
15
|
const ns = _nextI18Next?.ns;
|
|
16
16
|
|
|
@@ -14,7 +14,8 @@ export var appWithTranslation = function appWithTranslation(WrappedComponent) {
|
|
|
14
14
|
var configOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
15
15
|
var AppWithTranslation = function AppWithTranslation(props) {
|
|
16
16
|
var _nextI18Next$initialL, _props$router;
|
|
17
|
-
var
|
|
17
|
+
var _ref = props.pageProps || {},
|
|
18
|
+
_nextI18Next = _ref._nextI18Next; // pageProps may be undefined on strange setups, i.e. https://github.com/i18next/next-i18next/issues/2109
|
|
18
19
|
var locale = (_nextI18Next$initialL = _nextI18Next === null || _nextI18Next === void 0 ? void 0 : _nextI18Next.initialLocale) !== null && _nextI18Next$initialL !== void 0 ? _nextI18Next$initialL : props === null || props === void 0 ? void 0 : (_props$router = props.router) === null || _props$router === void 0 ? void 0 : _props$router.locale;
|
|
19
20
|
var ns = _nextI18Next === null || _nextI18Next === void 0 ? void 0 : _nextI18Next.ns;
|
|
20
21
|
|
|
@@ -35,8 +36,8 @@ export var appWithTranslation = function appWithTranslation(WrappedComponent) {
|
|
|
35
36
|
if (!(userConfig !== null && userConfig !== void 0 && (_userConfig$i18n = userConfig.i18n) !== null && _userConfig$i18n !== void 0 && _userConfig$i18n.defaultLocale)) {
|
|
36
37
|
throw new Error('config.i18n does not include a defaultLocale property');
|
|
37
38
|
}
|
|
38
|
-
var
|
|
39
|
-
initialI18nStore =
|
|
39
|
+
var _ref2 = _nextI18Next || {},
|
|
40
|
+
initialI18nStore = _ref2.initialI18nStore;
|
|
40
41
|
var resources = configOverride !== null && configOverride !== void 0 && configOverride.resources ? configOverride.resources : initialI18nStore;
|
|
41
42
|
if (!locale) locale = userConfig.i18n.defaultLocale;
|
|
42
43
|
var instance = createClient(_objectSpread(_objectSpread({}, createConfig(_objectSpread(_objectSpread({}, userConfig), {}, {
|