npm start support all locale
See original GitHub issueHave you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Description
When working at a multilingual docusaurus project, I always switch between npm start
and npm start --locale zh-cn
.
Could the user just run npm start
and let localeDropdown
works normally?
Has this been requested on Canny?
No
Motivation
Currently, npm start
doesn’t work for multi language site. npm run
is not a full-version preview.
Could the user just run npm start
and let localeDropdown
works normally?
API design
No response
Have you tried building it?
No response
Self-service
- I’d be willing to contribute this feature to Docusaurus myself.
Issue Analytics
- State:
- Created a year ago
- Comments:9
Top Results From Across the Web
locale - npm
Browser locale negotiation for node.js. Latest version: 0.1.0, last published: ... Start using locale in your project by running `npm i locale`.
Read more >locale-codes - npm
Start using locale-codes in your project by running `npm i locale-codes`. There are 10 other projects in the npm registry using locale-codes.
Read more >locale-util - npm
Start using locale-util in your project by running `npm i locale-util`. There are 3 other projects in the npm registry using locale-util.
Read more >locale-code - npm
Start using locale-code in your project by running `npm i locale-code`. There are 50 other projects in the npm registry using locale-code.
Read more >locale-manager - npm
Setup: · Create a locales directory in the root of your Node.js project. mkdir locales · Create all supported locale files within the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If it’s important for you to preview both locales at the same time, I suggest you use
yarn start
for your primary locale, andyarn start --port 3001 --locale zh-Hans
for your second locale. You won’t get to use the locale dropdown, but at least you can compare them side-by-side.Update: both locales will try to write generated files to the same directory, so if you are starting two locales in parallel, you have to change the generated directory of one locale, for example:
cross-env DOCUSAURUS_GENERATED_FILES_DIR_NAME=.docusaurus/zh-Hans yarn start --locale zh-Hans --port 3001
cross-env
is an npm package. In practice, if you are using Unix, you may not install it. I’m only adding this because setting environment variables on Windows is tricky. The main idea is you need to set theDOCUSAURUS_GENERATED_FILES_DIR
environment variable.