Next.js Discord

Discord Forum

Is it possible having i18n without relying on the route (appDir).

Unanswered
White-winged Scoter posted this in #help-forum
Open in Discord
White-winged ScoterOP
In a SAAS platform, having the language in the url might be more annoying than helpful. Every user has his own preferences and sharing a link should not interfere with a users preferences.

I can only find examples where the locale is placed in the url, none without.

4 Replies

American black bear
Its pretty straight forward: Just add the locale you want to use into a cookie and use it where you want
White-winged ScoterOP
I'm thinking on how I can implement both. Routing for the app, without the routing for the app part.

Not sure what the added value of the "🤣" reaction is to this question @Jumbo flying squid.

Yes, I could create a custom integration where I work with a cookie or a database entry value, but is there a way to have the best of both worlds.
Jumbo flying squid
Apologies! I must have done that on accident!
American black bear
@White-winged Scoter then you might use the locales on itself how next.js appDir tells you to use and then use middleware + rewrites.
You can e. g. get the cookie in the middleware and rewrite it to the locale you want to render.