next-i18next
Advanced tools
Comparing version 0.10.0 to 0.10.1
@@ -10,2 +10,4 @@ "use strict"; | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); | ||
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
@@ -29,2 +31,4 @@ | ||
var _urlParse = _interopRequireDefault(require("url-parse")); | ||
/* | ||
@@ -67,2 +71,3 @@ This `Link` component is a wrap of the standard | ||
var _this$props = this.props, | ||
as = _this$props.as, | ||
children = _this$props.children, | ||
@@ -79,5 +84,9 @@ href = _this$props.href; | ||
if (localeSubpaths && lng && lng !== defaultLanguage) { | ||
var url = new _urlParse.default(href, true); | ||
url.set('query', (0, _objectSpread2.default)({}, url.query, { | ||
lng: lng | ||
})); | ||
return _react.default.createElement(_link.default, { | ||
href: "".concat(href, "?lng=").concat(lng), | ||
as: "/".concat(lng).concat(href) | ||
href: url.href, | ||
as: "/".concat(lng).concat(as || href) | ||
}, children); | ||
@@ -87,3 +96,4 @@ } | ||
return _react.default.createElement(_link.default, { | ||
href: href | ||
href: href, | ||
as: as | ||
}, children); | ||
@@ -96,4 +106,8 @@ } | ||
Link.propTypes = { | ||
as: _propTypes.default.string, | ||
children: _propTypes.default.node.isRequired, | ||
href: _propTypes.default.string.isRequired | ||
}; | ||
Link.defaultProps = { | ||
as: undefined | ||
/* | ||
@@ -100,0 +114,0 @@ Usage of `withNamespaces` here is just to |
@@ -14,2 +14,4 @@ "use strict"; | ||
var _url = require("url"); | ||
function _default(nexti18next, app, server) { | ||
@@ -27,3 +29,4 @@ var config = nexti18next.config, | ||
var lng = req.params.lng; | ||
app.render(req, res, req.url.replace("/".concat(lng), ''), { | ||
var url = (0, _url.parse)(req.url).pathname; | ||
app.render(req, res, url.replace("/".concat(lng), ''), { | ||
lng: lng | ||
@@ -30,0 +33,0 @@ }); |
{ | ||
"name": "next-i18next", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"main": "dist/index.js", | ||
@@ -64,4 +64,5 @@ "repository": "git@github.com:isaachinman/next-i18next.git", | ||
"react-i18next": "^8.3.8", | ||
"react-tree-walker": "^4.3.0" | ||
"react-tree-walker": "^4.3.0", | ||
"url-parse": "^1.4.4" | ||
} | ||
} |
@@ -29,7 +29,8 @@ # next-i18next | ||
. | ||
├── static | ||
├── en | ||
| └── common.json | ||
└── de | ||
└── common.json | ||
└── static | ||
└── locales | ||
├── en | ||
| └── common.json | ||
└── de | ||
└── common.json | ||
``` | ||
@@ -154,2 +155,2 @@ | ||
Please do! All PRs and issues will be thoroughly reviewed. | ||
Please do! All PRs and issues will be thoroughly reviewed. |
Sorry, the diff of this file is not supported yet
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
204522
670
155
12
+ Addedurl-parse@^1.4.4
+ Addedquerystringify@2.2.0(transitive)
+ Addedrequires-port@1.0.0(transitive)
+ Addedurl-parse@1.5.10(transitive)