facebook / facebook/docusaurus
Improve i18n DX to translate the `_category_.yml` labels
- Ngôn ngữ chính
- TypeScript
- Star
- 66.2k
- Fork
- 10k
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 52
Mô tả
### Have you read the Contributing Guidelines on issues?
- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#issues).
### Prerequisites
- [X] I'm using the latest version of Docusaurus.
- [ ] I have tried the `npm run clear` or `yarn clear` command.
- [ ] I have tried `rm -rf node_modules yarn.lock package-lock.json` and re-installing packages.
- [ ] I have tried creating a repro with https://new.docusaurus.io.
- [ ] I have read the console error message carefully (if applicable).
### Description
I am currently internationalizing (i18n) a document written in Korean into English.
The sidebar of my document is all autogenerated sidebar.
```js
// sidebar.js
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
// By default, Docusaurus generates a sidebar from the docs folder structure
exampleSidebar: [{ type: 'autogenerated', dirName: 'example-dir' }],
};
module.exports = sidebars;
```
I have copied the `/docs` subfolders originally written in Korean to `/i18n/en/docusaurus-plugin-content-docs` and I am translating the documents into English. However, even if I change the `label` attribute in `/i18n/en/docusaurus-plugin-content-docs/example-dir/under-example-dir/_category_.yml` to English, it continues to appear in Korean in the sidebar.
```yaml
# /i18n/en/docusaurus-plugin-content-docs/example-dir/under-example-dir/_category_.yml
position: 2
label: 'Example'
collapsible: true
collapsed: false
```
```yaml
# /docs/example-dir/under-example-dir/_category_.yml
position: 2
label: '예제'
collapsible: true
collapsed: false
```
I run docusaurus following step:
1. `yarn dev --locale en`
But in `example-dir` sidebar, it displays Korean, not English.
I already wrote about this in #8986
### Reproducible demo
https://github.com/dogu-team/dogu-docs
### Steps to reproduce
1. Clone or fork https://github.com/dogu-team/dogu-docs this repository and open
2. Checkout branch to `label_reproduce`
3. Enter `yarn newbie`
4. Change `docs/host-and-device/host/_category_.yml` as
```yaml
position: 2
label: '호스트'
collapsible: true
collapsed: false
```
5. Check `i18n/en/docusaurus-plugin-content-docs/current/host-and-device/host/_category_.yml`. This should be
```yaml
position: 2
label: 'Host'
collapsible: true
collapsed: false
```
6. `yarn dev --locale en` or `yarn build && yarn serve`
7. Go to http://localhost:3100/en/host-and-device/host/get-started and check sidebar.
8. Sidebar label will still '호스트'(korean), not 'Host'.
### Expected behavior
Sidebar label should be 'Host', not Korean
### Actual behavior
Sidebar label shows '호스트', not English
### Your environment
- Public source code: https://github.com/dogu-team/dogu-docs/tree/label_reproduce
- Public site URL: https://docs.dogutech.io
- Docusaurus version used: 2.4.1
- Environment name and version (e.g. Chrome 89, Node.js 16.4): Node.js 16.16.0
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS Ventura 13.13.1 (a)
### Self-service
- [ ] I'd be willing to fix this bug myself.
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.