Replies: 12 comments 12 replies
-
I'm facing the same issue as you. I've also posted a question here too, but no answers provided. The solution I found was either of the following options:
The first option seems to be the most suitable and stable solution, but there are some caveats in it. I'm still thinking how to approach this issue. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I need this feature too. I also posted about this but idk if someone saw that. I hope they will provide a config for translating routes soon. |
Beta Was this translation helpful? Give feedback.
-
I had a similar requirement and managed to achieve what I want. I have two locales
I guess the initial release of nextjs 10 had a bug, therefor I upgraded to the latest canary version. Is that what you are after? |
Beta Was this translation helpful? Give feedback.
-
Here you go:
I think I read it in the RFC for rewrite and redirect. I had this logic already in nextjs 9, but back then I had to implement my own logic to have this subpaths. With nextjs 10 it is easier and has less boilerplate. As I said before you might need the latest canary. |
Beta Was this translation helpful? Give feedback.
-
@hk86 that is a great solution! But how do you handle linking? I've tried your suggested config, but when I link in the client side from a page to the root page it ignores my locale config. There is a simple way to link every page to The only option I can think right now is creating a custom hook that returns a list of mapped paths, and the pass it to the |
Beta Was this translation helpful? Give feedback.
-
Looks like this would be the next improvement of the localisation? Because indeed it would make sense to have a different path per language.
Because with the redirect solution above I guess you are not able to keep that route displayed in the browser? @delucca @hk86 What I've done for our main page is abuse the |
Beta Was this translation helpful? Give feedback.
-
I've detected a major issue with this approach. I do not have the issue locally, but when I deploy to the Now platform: #18902 |
Beta Was this translation helpful? Give feedback.
-
We had to do this middleware: https://github.com/trisbee/next-i18n-routes-middleware for our sites and still looking forward for official way how to achive simillar results without custom SSR. |
Beta Was this translation helpful? Give feedback.
-
Any progress on this one? |
Beta Was this translation helpful? Give feedback.
-
Anyone make it work to change language for different slugs per language? Am i missing something? |
Beta Was this translation helpful? Give feedback.
-
I need this feature as well |
Beta Was this translation helpful? Give feedback.
-
Hey!
So stoked to get to use Next 10 a reallife client project, but I'm currently stumped w/ the new internationalization feature.
I need my routes slugs to be translatable, so instead of
I need to be able to have a different slug by language, e.g.
I'm (sadly) aware this was not included in the i18n RFC, but I really (badly) need those page names to be translatable.
I tried fooling around with rewrites, without any success (it broke + it wouldn't work w/ client-side routing)
I found nuxt-roots which felt promising (albeit a little bit sketchy), but didn't work at all, not even compiling.
I'm at a total loss with a client that insists on having localizing routing.
Any ideas on how I could work arount this current limitation?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions