-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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
process.env.DOCUSAURUS_CURRENT_LOCALE is undefined in serve #8849
Comments
@laojun according to you, which value The original PR (#8677) mentions that this env variable is a temporary workaround until we figure out a better API And it is also explained that you have to program defensively against the value being potentially undefined.
My suggestion, try something like this: baseUrl: process.env.DOCUSAURUS_CURRENT_LOCALE
? `/${process.env.DOCUSAURUS_CURRENT_LOCALE}/`
: "/"; // or "/zh-cn/" ??? Going to close because for me it's not a bug, it's a documented limitation of the current implementation. Even if we had a better API, I have no idea which locale we should define as the "current one" when running Open to discussing this more but please explain me your expectations when running this command. |
Yeah, that makes sense :/ Multiple locales are served at once so it's hard to tell |
Thanks for the reply。 I try it like this
It goes well when i choose locale |
That's probably a bug in the locale dropdown. Can you open another dedicated issue and provide a repro we can look at? |
This is working as intended. We don't support two locales both having base URLs—one must be the default and not have any base URL. When you choose |
I think we could fix this behavior as part of #6731 This means you could keep
Does it make sense? |
Discussed in #8848
Originally posted by laojun March 30, 2023
Hi:
First of all, Thanks for the v2.4。
I use
process.env.DOCUSAURUS_CURRENT_LOCALE
to solve my problem in https://github.com/facebook/docusaurus/discussions/8745。Here is my docusaurus.config.js
Seems right when i run build
But error when i run server
How can i make it right when i run server?
Thanks
The text was updated successfully, but these errors were encountered: