diff --git a/packages/docusaurus-plugin-content-docs/src/translations.ts b/packages/docusaurus-plugin-content-docs/src/translations.ts index bc6f8bbb8b..e64e1dde7b 100644 --- a/packages/docusaurus-plugin-content-docs/src/translations.ts +++ b/packages/docusaurus-plugin-content-docs/src/translations.ts @@ -48,8 +48,8 @@ function getSidebarTranslationFileContent( const categories = collectSidebarCategories(sidebar); - const categoryContent: TranslationFileContent = Object.fromEntries( - categories.flatMap((category) => { + const categoryEntries: TranslationMessageEntry[] = categories.flatMap( + (category) => { const entries: TranslationMessageEntry[] = []; entries.push([ @@ -82,9 +82,21 @@ function getSidebarTranslationFileContent( } return entries; - }), + }, ); + _.chain(categoryEntries) + .groupBy((entry) => entry[0]) + .forEach((group, key) => { + if (group.length > 1) { + console.warn(`KEY CONFLICT FOR key = ${key}`, group.length); + } + }) + .value(); + + const categoryContent: TranslationFileContent = + Object.fromEntries(categoryEntries); + const links = collectSidebarLinks(sidebar); const linksContent: TranslationFileContent = Object.fromEntries( links.map((link) => [ diff --git a/packages/docusaurus/src/server/plugins/plugins.ts b/packages/docusaurus/src/server/plugins/plugins.ts index f16007a5ec..3c0a9327b7 100644 --- a/packages/docusaurus/src/server/plugins/plugins.ts +++ b/packages/docusaurus/src/server/plugins/plugins.ts @@ -81,13 +81,16 @@ async function executePluginContentLoading({ plugin.loadContent?.(), ); - content = await PerfLogger.async('translatePluginContent()', () => - translatePluginContent({ - plugin, - content, - context, - }), - ); + const translate = false; + if (translate) { + content = await PerfLogger.async('translatePluginContent()', () => + translatePluginContent({ + plugin, + content, + context, + }), + ); + } const defaultCodeTranslations = (await PerfLogger.async('getDefaultCodeTranslationMessages()', () => diff --git a/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/alpha/_category_.json b/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/alpha/_category_.json new file mode 100644 index 0000000000..a1689a31d9 --- /dev/null +++ b/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/alpha/_category_.json @@ -0,0 +1,6 @@ +{ + "label": "Alpha", + "link": { + "type": "generated-index" + } +} diff --git a/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/alpha/test/_category_.json b/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/alpha/test/_category_.json new file mode 100644 index 0000000000..0a027d5781 --- /dev/null +++ b/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/alpha/test/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "CategoryLabelTest", + "link": { + "type": "generated-index", + "title": "test category in Alpha", + "description": "Test description in Alpha" + } +} diff --git a/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/alpha/test/test.md b/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/alpha/test/test.md new file mode 100644 index 0000000000..4ee22315f8 --- /dev/null +++ b/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/alpha/test/test.md @@ -0,0 +1,4 @@ +--- +--- + +## Test file diff --git a/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/beta/_category_.json b/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/beta/_category_.json new file mode 100644 index 0000000000..86eedaae9f --- /dev/null +++ b/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/beta/_category_.json @@ -0,0 +1,6 @@ +{ + "label": "Beta", + "link": { + "type": "generated-index" + } +} diff --git a/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/beta/test/_category_.json b/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/beta/test/_category_.json new file mode 100644 index 0000000000..668e049124 --- /dev/null +++ b/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/beta/test/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "CategoryLabelTest", + "link": { + "type": "generated-index", + "title": "test category in Beta", + "description": "Test description in Beta" + } +} diff --git a/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/beta/test/test.md b/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/beta/test/test.md new file mode 100644 index 0000000000..4ee22315f8 --- /dev/null +++ b/website/_dogfooding/_docs tests/tests/Conflicts/category-index-name/beta/test/test.md @@ -0,0 +1,4 @@ +--- +--- + +## Test file