Skip to content

fix(i18n): add unique keys to duplicate sidebar categories - #4621

Open
thetaPC wants to merge 1 commit into
mainfrom
jp-react-19-fix
Open

fix(i18n): add unique keys to duplicate sidebar categories#4621
thetaPC wants to merge 1 commit into
mainfrom
jp-react-19-fix

Conversation

@thetaPC

@thetaPC thetaPC commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Issue URL: N/A

What is the current behavior?

The production build fails on main. docusaurus build completes en and then throws on ja:

[ERROR] Error: Unable to build website for locale ja.
  [cause]: Error: Multiple docs sidebar items produce the same translation key.
  - `sidebar.docs.category.Build Your First App`: 3 duplicates found

Three sidebar categories, one per framework, all use the label "Build Your First App". Docusaurus derives a category's translation id as sidebar.docs.category.${category.key ?? category.label}, so all three collapse onto a single id.

What is the new behavior?

Each of those categories gets a unique key, so each gets its own translation id and the ja build succeeds:

label: 'Build Your First App',
key: 'angular-your-first-app',

Six additions in two files: sidebars.js (current/v8) and versioned_sidebars/version-v7-sidebars.json. Labels are untouched, so the sidebar looks identical.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Why the React 19 upgrade surfaced this

React 19 did not introduce the duplicate labels, which have been there for years. It forced the Docusaurus bump that turned them into an error. @docusaurus/plugin-debug@3.7.0 pinned react-json-view-lite: ^1.2.0, and no 1.x release of that package supports React 19, so clearing the last peer warning required moving the Docusaurus family to 3.10.2. Somewhere in that range Docusaurus added the ensureNoSidebarDuplicateEntries validation: it appears 0 times in plugin-content-docs@3.7.0 and twice in 3.10.2. What was previously tolerated, three categories silently sharing one translation string, is now fatal.

Why it was not caught before merging

Two things hid it, and both are worth fixing separately. First, build:preview is docusaurus build --locale en while only build:production builds all locales, so no PR preview has ever exercised ja. Second, even building ja locally passes, because Docusaurus infers whether to translate from whether i18n/<locale> exists, and that directory is only created on CI by scripts/i18n.sh during prebuild. Creating an empty i18n/ja locally reproduces the failure exactly, which is how this fix was verified: failing before, passing after.

@thetaPC
thetaPC marked this pull request as ready for review August 6, 2026 21:57
@thetaPC
thetaPC requested a review from a team as a code owner August 6, 2026 21:57
@thetaPC
thetaPC requested a review from BenOsodrac August 6, 2026 21:57
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-docs Ready Ready Preview Aug 6, 2026 9:57pm

Request Review

@thetaPC
thetaPC enabled auto-merge (squash) August 6, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants