How to change languages based on the User object without locale prefixes #778
Replies: 3 comments 1 reply
-
That is a very interesting use case! I'm not sure about the whole routing part, someone else can answer that. I guess you would simply disable prefixes and disable rewrites? As for getting the information from a user object, I've done that in the past and it is a very common thing - users can choose which language they prefer, which has higher seniority than cookies, geoip or header. I believe that in this case you'd "compose middleware" to override the locale that the middleware has set. Alternatively, (and perhaps simpler) you can simply forcibly set a cookie based on the user's preferences :D |
Beta Was this translation helpful? Give feedback.
-
I'm also trying create a nice solution on this matter. Some good docs on this would be super nice. |
Beta Was this translation helpful? Give feedback.
-
This question just came up today again, see my answer here: #892 (comment) |
Beta Was this translation helpful? Give feedback.
-
Hello!
I am using next-intl for my app and I need a way to change between languages, without adding /de or /en to the path. I need to set the locale based on the authenticated user's preferences. How can I change the locale?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions