Skip to content

Commit

Permalink
Merge pull request #55 from KhodorAmmar/master
Browse files Browse the repository at this point in the history
preserve original querystring parameters by appending them with lng
  • Loading branch information
isaachinman authored Dec 16, 2018
2 parents ba1c5f1 + 2c3cb59 commit 872b625
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/middlewares/next-i18next-middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export default function (nexti18next, app, server) {
server.get(/^\/(?!_next|static).*$/, lngPathDetector)
server.get(`/:lng(${allLanguages.join('|')})/*`, (req, res) => {
const { lng } = req.params
const { query } = req
const url = parse(req.url).pathname
app.render(req, res, url.replace(`/${lng}`, ''), { lng })
app.render(req, res, url.replace(`/${lng}`, ''), { lng, ...query })
})
}
}

0 comments on commit 872b625

Please sign in to comment.