next-i18next
Advanced tools
Comparing version 0.15.0 to 0.16.0
@@ -15,8 +15,13 @@ "use strict"; | ||
var performedRedirect = false; | ||
req.i18n.options.allLanguages.forEach(function (lng) { | ||
if (pathname === "/".concat(lng)) { | ||
res.redirect(301, pathname.replace("/".concat(lng), "/".concat(lng, "/")) + (search || '')); | ||
performedRedirect = true; | ||
} | ||
}); | ||
next(); | ||
if (!performedRedirect) { | ||
next(); | ||
} | ||
}; | ||
@@ -23,0 +28,0 @@ |
@@ -28,8 +28,13 @@ "use strict"; | ||
language is not set to default, give | ||
preference to the path and reset their | ||
language. | ||
preference to the language and redirect | ||
their path. | ||
*/ | ||
if (language !== defaultLanguage && !req.url.startsWith("/".concat(language, "/"))) { | ||
req.i18n.changeLanguage(defaultLanguage); | ||
allLanguages.forEach(function (lng) { | ||
if (req.url.startsWith("/".concat(lng, "/"))) { | ||
req.url = req.url.replace("/".concat(lng, "/"), '/'); | ||
} | ||
}); | ||
res.redirect(301, req.url.replace('/', "/".concat(language, "/"))); | ||
} | ||
@@ -36,0 +41,0 @@ /* |
{ | ||
"name": "next-i18next", | ||
"version": "0.15.0", | ||
"version": "0.16.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:isaachinman/next-i18next.git", |
@@ -160,6 +160,2 @@ # next-i18next | ||
## Contributing | ||
Please do! All PRs and issues will be thoroughly reviewed. | ||
## Contributors | ||
@@ -166,0 +162,0 @@ |
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
386593
858
170