question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm start support all locale

See original GitHub issue

Have you 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:closed
  • Created a year ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
Josh-Cenacommented, Jun 18, 2022

If it’s important for you to preview both locales at the same time, I suggest you use yarn start for your primary locale, and yarn 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

1reaction
Josh-Cenacommented, Jun 27, 2022

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 the DOCUSAURUS_GENERATED_FILES_DIR environment variable.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found