Next.js Discord

Discord Forum

Nextjs - language global state

Unanswered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
Anyone knows how can I keep a global language string state in next js and pass it down, using as less client components as possible? I want to give to the user the possibility to change languages, but be as much as possible server side rendered. Is this possible?

5 Replies

Cookies
they allow to store state that is available both client-side and server-side, perfect to store configuration like the user language
it's not uncommon to store this information in the user document in your databse too, if you want to allow the user to pick the language once for all
or to combine multiple approaches