I need to manually set the user's locale and get access to it in getStaticProps
for a multilingual static site.
I have 2 questions.
- Is it possible to create a multilingual website without having language in the subpath or as a domain?
- Why is
Next
reading myNEXT_LOCALE
cookie wrong? I set the cookie tome
and it says that locale isen
. I getme
as a locale only when I go tolocalhost:3000/me
.
All I could find about the cookie is this sentence in the docs
Next.js supports overriding the accept-language header with a NEXT_LOCALE=the-locale cookie. This cookie can be set using a language switcher and then when a user comes back to the site it will leverage the locale specified in the cookie.
For example, if a user prefers the locale fr but a NEXT_LOCALE=en cookie is set the en locale will be used instead until the cookie is removed or expired.
Judging by this, the NEXT_LOCALE
cookie should be read instead of subpath or from the domain, but in my case, the NEXT_LOCALE
cookie is totally ignored.
Does this have something to do with "next": "10.0.5"
. Do I need to downgrade?
Or could it be that I misunderstood something?
Read more here: https://stackoverflow.com/questions/66278100/next-locale-cookie-is-being-ignored-am-i-doing-something-wrong
Content Attribution
This content was originally published by Mileta Dulovic at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.