next-i18next
Advanced tools
Comparing version 0.23.7 to 0.24.0
@@ -110,11 +110,6 @@ "use strict"; | ||
initialLanguage = _this$props.initialLanguage, | ||
initialI18nStore = _this$props.initialI18nStore; | ||
if (!process.browser) { | ||
initialLanguage = i18n.language; | ||
initialI18nStore = i18n.store.data; | ||
} | ||
initialI18nStore = _this$props.initialI18nStore, | ||
i18nServerInstance = _this$props.i18nServerInstance; | ||
return _react.default.createElement(_reactI18next.I18nextProvider, { | ||
i18n: i18n, | ||
i18n: i18nServerInstance || i18n, | ||
initialLanguage: initialLanguage, | ||
@@ -130,3 +125,3 @@ initialI18nStore: initialI18nStore | ||
_regenerator.default.mark(function _callee(ctx) { | ||
var wrappedComponentProps, req, initialI18nStore, initialLanguage, namespacesRequired, fallbackLng; | ||
var wrappedComponentProps, req, initialI18nStore, initialLanguage, i18nServerInstance, namespacesRequired, fallbackLng; | ||
return _regenerator.default.wrap(function _callee$(_context) { | ||
@@ -159,6 +154,7 @@ while (1) { | ||
initialI18nStore = {}; | ||
initialLanguage = null; // Step 1: Determine initial language | ||
initialLanguage = null; | ||
i18nServerInstance = null; // Step 1: Determine initial language | ||
if (!(req && req.i18n)) { | ||
_context.next = 15; | ||
_context.next = 16; | ||
break; | ||
@@ -169,10 +165,10 @@ } | ||
_context.next = 13; | ||
_context.next = 14; | ||
return i18n.changeLanguage(initialLanguage); | ||
case 13: | ||
_context.next = 16; | ||
case 14: | ||
_context.next = 17; | ||
break; | ||
case 15: | ||
case 16: | ||
if (Array.isArray(i18n.languages) && i18n.languages.length > 0) { | ||
@@ -182,3 +178,3 @@ initialLanguage = i18n.language; | ||
case 16: | ||
case 17: | ||
// Step 2: Determine namespace dependencies | ||
@@ -203,3 +199,3 @@ namespacesRequired = config.ns; | ||
if (!(req && req.i18n)) { | ||
_context.next = 26; | ||
_context.next = 27; | ||
break; | ||
@@ -224,12 +220,12 @@ } | ||
}); | ||
_context.next = 30; | ||
_context.next = 31; | ||
break; | ||
case 26: | ||
case 27: | ||
if (!(Array.isArray(i18n.languages) && i18n.languages.length > 0)) { | ||
_context.next = 30; | ||
_context.next = 31; | ||
break; | ||
} | ||
_context.next = 29; | ||
_context.next = 30; | ||
return Promise.all(namespacesRequired.filter(function (ns) { | ||
@@ -245,12 +241,23 @@ return !i18n.hasResourceBundle(i18n.languages[0], ns); | ||
case 29: | ||
case 30: | ||
initialI18nStore = i18n.store.data; | ||
case 30: | ||
case 31: | ||
// Step 4: Overwrite i18n.toJSON method to be able to serialize the instance | ||
if (req && req.i18n) { | ||
req.i18n.toJSON = function () { | ||
return null; | ||
}; | ||
i18nServerInstance = req.i18n; | ||
} // `pageProps` will get serialized automatically by NextJs | ||
return _context.abrupt("return", (0, _objectSpread2.default)({ | ||
initialI18nStore: initialI18nStore, | ||
initialLanguage: initialLanguage | ||
initialLanguage: initialLanguage, | ||
i18nServerInstance: i18nServerInstance | ||
}, wrappedComponentProps)); | ||
case 31: | ||
case 33: | ||
case "end": | ||
@@ -257,0 +264,0 @@ return _context.stop(); |
{ | ||
"name": "next-i18next", | ||
"version": "0.23.7", | ||
"version": "0.24.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:isaachinman/next-i18next.git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
411601
1029
3