Attempt to fix translation content conflict

This commit is contained in:
sebastien 2025-06-02 16:58:11 +02:00
parent dacfc17fb4
commit 7f05848713
8 changed files with 61 additions and 10 deletions

View file

@ -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) => [

View file

@ -81,6 +81,8 @@ async function executePluginContentLoading({
plugin.loadContent?.(),
);
const translate = false;
if (translate) {
content = await PerfLogger.async('translatePluginContent()', () =>
translatePluginContent({
plugin,
@ -88,6 +90,7 @@ async function executePluginContentLoading({
context,
}),
);
}
const defaultCodeTranslations =
(await PerfLogger.async('getDefaultCodeTranslationMessages()', () =>

View file

@ -0,0 +1,6 @@
{
"label": "Alpha",
"link": {
"type": "generated-index"
}
}

View file

@ -0,0 +1,8 @@
{
"label": "CategoryLabelTest",
"link": {
"type": "generated-index",
"title": "test category in Alpha",
"description": "Test description in Alpha"
}
}

View file

@ -0,0 +1,4 @@
---
---
## Test file

View file

@ -0,0 +1,6 @@
{
"label": "Beta",
"link": {
"type": "generated-index"
}
}

View file

@ -0,0 +1,8 @@
{
"label": "CategoryLabelTest",
"link": {
"type": "generated-index",
"title": "test category in Beta",
"description": "Test description in Beta"
}
}

View file

@ -0,0 +1,4 @@
---
---
## Test file