-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Locale switcher has confusing behavior in dev #8652
Comments
Please provide a repro using Docusaurus.new so I can easily inspect your setup. It's hard to figure out with text only and it's not very clear to me what this bug is, so any screenshot is also welcome. I don't know what you mean by "language URL added one by one" for example. Please use real examples using real URLs for expected/actual results. We'll re-open #8651 if the bug report is valid and if the code seems to fix it, and if possible add tests. |
I can reproduce this in dev but not in prod. This is because in dev there's only one locale anyway, so |
I see thanks, saw that before Maybe we could add an That looks better than simply removing the locale dropdown in dev, which might confuse users? |
When I say "disable" I mean have it show the "forbidden" icon when hovered. (We may still show the dropdown content for the purpose of preview). |
Yes using forbidden + prevent selection looks like a nice idea |
@slorber just to clarify, we should not expect locale switching to work correctly in local environments right? When I attempt to do it locally my docs get a 404, however when I build and serve everything works as expected. |
That's right; in dev we can only start the site in one locale. |
ah good to know, spent a couple hours troubleshooting this |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
After I chose a language, the locale added to the url one by one. I assumed it to be replaced. For example, my locales is ['en', 'zh-Hant', 'zh-Hans'], the initial url is http://localhost:3000/docu/docs/intro, after I chose zh-Hant then chose zh-Hans, the url became http://localhost:3000/zh-Hans/zh-Hant/docu/docs/intro. And I found currentLocale is not updated.
Reproducible demo
No response
Steps to reproduce
Expected behavior
language url be replaced
Actual behavior
language url added one by one
Your environment
Self-service
The text was updated successfully, but these errors were encountered: