Skip to content

feat(docs): improve docs translations without key conflicts - #11457

Closed
trofim24 wants to merge 1 commit into
meta:mainfrom
trofim24:patch-2
Closed

trofim24 wants to merge 1 commit into
meta:mainfrom
trofim24:patch-2

Conversation

@trofim24

@trofim24 trofim24 commented Oct 5, 2025 •

Copy link
Copy Markdown
Contributor

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

In #11228 the key added as solution of #10913.
I want to improve autogenerate key for translations categories and docs without key.

And also this code is faster, it does only 1 recursion pass for all sidebar instead of 4 before and does not create additional arrays.

Test Plan

Previos key for categories and docs was category.label and doc.label without key definition. I think we can improve solution for sites like this:

Topic A
  Getting Started
    ...
  How to guides
    ...
  References
    ...
Topic B
  Getting Started
    ...
  How to guides
    ...
  References
    ...

And key for Getting Started for example will be Topic A.Getting Started and Topic B.Getting Started.

Test links

Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/

Related issues/PRs

@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Oct 5, 2025
@netlify

netlify Bot commented Oct 5, 2025

Copy link
Copy Markdown

✅ [V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 150d2ba
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/68e29e216ad7200007c5f992
😎 Deploy Preview https://deploy-preview-11457--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@slorber

slorber commented Oct 9, 2025

Copy link
Copy Markdown
Collaborator

Thanks for trying, but as explained here:

we explicitly designed this to be retro-compatible and not to use the parent items to generate the keys.

We considered a solution like this, and it would be very annoying if changing the label of one parent category could inadvertently invalidate all the translation keys of all the items underneath, also impacting all i18n users that do not even have key conflicts in the first place.

For this reason, I still believe I made the right choice, and am closing, but still open to discussing the design decision and see how to make your use case easier tp achieve from a different angle.

@slorber slorber closed this Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants