fix(web): set locale cookie on docs language switch#17667
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate PRs FoundThese PRs appear to address similar locale/language switching issues:
Note: PR #17667 (current PR) references issue #17665. You should verify whether these older PRs were closed without fixing the issue, or if they took a different approach that didn't fully resolve the language switching problem. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #12063
Closes #14409
Closes #14997
Closes #15194
Closes #15904
Closes #15984
Closes #16278
Closes #17665
Closes #18541
Closes #22415
Type of change
What does this PR do?
The docs language selector can't switch back to English from any other language. English is the root locale (/docs/) while others have a prefix (/docs/fr/). When navigating to /docs/, the console proxy falls back to the
oc_localecookie to detect locale, but the cookie still holds the previous language, so it serves that language again.This PR overrides Starlight's LanguageSelect component to set the
oc_localecookie to the correct value before window.location.pathname triggers navigation. The proxy then reads the updated cookie and serves the right locale.How did you verify your code works?
Ran the docs site and console app locally. Switched from English to French, then back to English - previously stuck on French, now correctly returns to English. Tested multiple language round-trips (English -> French -> English -> Chinese) and verified the
oc_localecookie updates correctly in devtools after each switch.Screenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist
If you do not follow this template your PR will be automatically rejected.