Docs: NEXT_LOCALE cookie
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
What is the improvement or update you wish to see?
This functionality is explained to just blanket work, but it doesn't. If implementing a locale / language switcher with full domain switching, the cookie can only be set on the current domain and thus doesn't carry when you get to the other domain. It should be explained that this method can only work when operating off of a single domain.
Is there any context that might help us understand?
Let's say I have 2 domains:
example.co (for en-US) and example.ca (for en-CA)
As a US visitor who visits the example.ca site, I am redirected to example.co (good).
Upon interacting with the language switcher to force the Canada locale, we can set the NEXT_LOCALE cookie on the example.co domain (the domain we're on), but we can't set the cookie on example.ca (the domain we want to be on) because of the Same Origin Policy. Now when our language switcher interacts with the router to send us to the example.ca domain, the cookie isn't present and we get redirected back to example.co. Sad.
Does the docs page already exist? Please link to it.
https://nextjs.org/docs/pages/building-your-application/routing/internationalization
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the linked internationalization documentation page and find the section describing the NEXT_LOCALE cookie. Clarify that this approach works for a single domain and that the cookie cannot be carried across separate domains such as example.co and example.ca; the documentation is done when this limitation is explicit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100