facebook / facebook/docusaurus

Improve i18n DX to translate the `_category_.yml` labels

Aperta
#8,996 13 commenti 0 reazioni 0 assegnatari Vedi su GitHub
domain: i18n proposal
Lingua principale
TypeScript
Stelle
66.2k
Fork
10k
Merge medio
1g 3h
PR unite (30g)
52

Descrizione

### 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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.