Skip to content

Improve i18n DX to translate the _category_.yml labels #8996

Open
@Ikalli

Description

Have you read the Contributing Guidelines on issues?

Prerequisites

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

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

# /i18n/en/docusaurus-plugin-content-docs/example-dir/under-example-dir/_category_.yml
position: 2
label: 'Example'
collapsible: true
collapsed: false
# /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
    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
    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

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Assignees

No one assigned

    Labels

    domain: i18nRelated to the i18n systemproposalThis issue is a proposal, usually non-trivial change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions