Closed stevethatcodes closed 5 years ago
Currently, this is not possible. The middleware is rather simple: https://github.com/i18next/i18next-express-middleware/blob/master/src/index.js#L136
So one option is to create your own. Or add a PR opting out of translating a route part, eg. like: /:lng/[some-other-translated-path]'
or similar
@jamuhl Thanks for the response. I suspected this was the case but thank you for confirming that it's not currently possible. If it's something I come up with a nice solution to I'll be sure to raise a PR.
would be great...rather sure others would like this feature too
You may find that useful:
https://github.com/zeit/next.js/issues/8241#issuecomment-519551275
@jamuhl We actually ended up solving this without this middleware, but instead writing our own middleware that translate routes and integrates with our Inversify-Express server.
Firstly, thanks for all the great work with i18next!
I had a question regarding the ability to specify localised urls on-demand, instead of setting the localised URLs upfront using
i18nextMiddleware.addRoute(...)
.What I am trying to achieve is something along the lines of (pseudo-code):
en.json:
de.json:
Where the above urls will match when the language and translated path are compatible with each-other.
E.g. /en/some-translated-path <-- 200 /en/some-translated-path-de <-- 404
Is this something that i18next-express-middleware would facilitate, or should I write a custom middleware specifically for this need?