mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-26 01:33:02 +00:00
Slightly improve translation error message formatting
This commit is contained in:
parent
684a878eda
commit
66c80fc799
|
|
@ -5,27 +5,27 @@ exports[`getLoadedContentTranslationFiles returns translation files 1`] = `
|
|||
{
|
||||
"content": {
|
||||
"sidebar.docs.category.Getting started": {
|
||||
"description": "The label for category Getting started in sidebar docs",
|
||||
"description": "The label for category 'Getting started' in sidebar 'docs'",
|
||||
"message": "Getting started",
|
||||
},
|
||||
"sidebar.docs.category.Getting started.link.generated-index.description": {
|
||||
"description": "The generated-index page description for category Getting started in sidebar docs",
|
||||
"description": "The generated-index page description for category 'Getting started' in sidebar 'docs'",
|
||||
"message": "Getting started index description",
|
||||
},
|
||||
"sidebar.docs.category.Getting started.link.generated-index.title": {
|
||||
"description": "The generated-index page title for category Getting started in sidebar docs",
|
||||
"description": "The generated-index page title for category 'Getting started' in sidebar 'docs'",
|
||||
"message": "Getting started index title",
|
||||
},
|
||||
"sidebar.docs.doc.Second doc translatable": {
|
||||
"description": "The label for the doc item Second doc translatable in sidebar docs, linking to the doc doc2",
|
||||
"description": "The label for the doc item 'Second doc translatable' in sidebar 'docs', linking to the doc doc2",
|
||||
"message": "Second doc translatable",
|
||||
},
|
||||
"sidebar.docs.link.Link label": {
|
||||
"description": "The label for link Link label in sidebar docs, linking to https://facebook.com",
|
||||
"description": "The label for link 'Link label' in sidebar 'docs', linking to 'https://facebook.com'",
|
||||
"message": "Link label",
|
||||
},
|
||||
"sidebar.otherSidebar.doc.Fifth doc translatable": {
|
||||
"description": "The label for the doc item Fifth doc translatable in sidebar otherSidebar, linking to the doc doc5",
|
||||
"description": "The label for the doc item 'Fifth doc translatable' in sidebar 'otherSidebar', linking to the doc doc5",
|
||||
"message": "Fifth doc translatable",
|
||||
},
|
||||
"version.label": {
|
||||
|
|
@ -38,27 +38,27 @@ exports[`getLoadedContentTranslationFiles returns translation files 1`] = `
|
|||
{
|
||||
"content": {
|
||||
"sidebar.docs.category.Getting started": {
|
||||
"description": "The label for category Getting started in sidebar docs",
|
||||
"description": "The label for category 'Getting started' in sidebar 'docs'",
|
||||
"message": "Getting started",
|
||||
},
|
||||
"sidebar.docs.category.Getting started.link.generated-index.description": {
|
||||
"description": "The generated-index page description for category Getting started in sidebar docs",
|
||||
"description": "The generated-index page description for category 'Getting started' in sidebar 'docs'",
|
||||
"message": "Getting started index description",
|
||||
},
|
||||
"sidebar.docs.category.Getting started.link.generated-index.title": {
|
||||
"description": "The generated-index page title for category Getting started in sidebar docs",
|
||||
"description": "The generated-index page title for category 'Getting started' in sidebar 'docs'",
|
||||
"message": "Getting started index title",
|
||||
},
|
||||
"sidebar.docs.doc.Second doc translatable": {
|
||||
"description": "The label for the doc item Second doc translatable in sidebar docs, linking to the doc doc2",
|
||||
"description": "The label for the doc item 'Second doc translatable' in sidebar 'docs', linking to the doc doc2",
|
||||
"message": "Second doc translatable",
|
||||
},
|
||||
"sidebar.docs.link.Link label": {
|
||||
"description": "The label for link Link label in sidebar docs, linking to https://facebook.com",
|
||||
"description": "The label for link 'Link label' in sidebar 'docs', linking to 'https://facebook.com'",
|
||||
"message": "Link label",
|
||||
},
|
||||
"sidebar.otherSidebar.doc.Fifth doc translatable": {
|
||||
"description": "The label for the doc item Fifth doc translatable in sidebar otherSidebar, linking to the doc doc5",
|
||||
"description": "The label for the doc item 'Fifth doc translatable' in sidebar 'otherSidebar', linking to the doc doc5",
|
||||
"message": "Fifth doc translatable",
|
||||
},
|
||||
"version.label": {
|
||||
|
|
@ -71,27 +71,27 @@ exports[`getLoadedContentTranslationFiles returns translation files 1`] = `
|
|||
{
|
||||
"content": {
|
||||
"sidebar.docs.category.Getting started": {
|
||||
"description": "The label for category Getting started in sidebar docs",
|
||||
"description": "The label for category 'Getting started' in sidebar 'docs'",
|
||||
"message": "Getting started",
|
||||
},
|
||||
"sidebar.docs.category.Getting started.link.generated-index.description": {
|
||||
"description": "The generated-index page description for category Getting started in sidebar docs",
|
||||
"description": "The generated-index page description for category 'Getting started' in sidebar 'docs'",
|
||||
"message": "Getting started index description",
|
||||
},
|
||||
"sidebar.docs.category.Getting started.link.generated-index.title": {
|
||||
"description": "The generated-index page title for category Getting started in sidebar docs",
|
||||
"description": "The generated-index page title for category 'Getting started' in sidebar 'docs'",
|
||||
"message": "Getting started index title",
|
||||
},
|
||||
"sidebar.docs.doc.Second doc translatable": {
|
||||
"description": "The label for the doc item Second doc translatable in sidebar docs, linking to the doc doc2",
|
||||
"description": "The label for the doc item 'Second doc translatable' in sidebar 'docs', linking to the doc doc2",
|
||||
"message": "Second doc translatable",
|
||||
},
|
||||
"sidebar.docs.link.Link label": {
|
||||
"description": "The label for link Link label in sidebar docs, linking to https://facebook.com",
|
||||
"description": "The label for link 'Link label' in sidebar 'docs', linking to 'https://facebook.com'",
|
||||
"message": "Link label",
|
||||
},
|
||||
"sidebar.otherSidebar.doc.Fifth doc translatable": {
|
||||
"description": "The label for the doc item Fifth doc translatable in sidebar otherSidebar, linking to the doc doc5",
|
||||
"description": "The label for the doc item 'Fifth doc translatable' in sidebar 'otherSidebar', linking to the doc doc5",
|
||||
"message": "Fifth doc translatable",
|
||||
},
|
||||
"version.label": {
|
||||
|
|
|
|||
|
|
@ -232,35 +232,35 @@ describe('getLoadedContentTranslationFiles', () => {
|
|||
{
|
||||
"content": {
|
||||
"sidebar.sidebarWithConflicts.category.key-cat1": {
|
||||
"description": "The label for category COMMON LABEL in sidebar sidebarWithConflicts",
|
||||
"description": "The label for category 'COMMON LABEL' in sidebar 'sidebarWithConflicts'",
|
||||
"message": "COMMON LABEL",
|
||||
},
|
||||
"sidebar.sidebarWithConflicts.category.key-cat2": {
|
||||
"description": "The label for category COMMON LABEL in sidebar sidebarWithConflicts",
|
||||
"description": "The label for category 'COMMON LABEL' in sidebar 'sidebarWithConflicts'",
|
||||
"message": "COMMON LABEL",
|
||||
},
|
||||
"sidebar.sidebarWithConflicts.doc.key-doc4": {
|
||||
"description": "The label for the doc item COMMON LABEL in sidebar sidebarWithConflicts, linking to the doc doc4",
|
||||
"description": "The label for the doc item 'COMMON LABEL' in sidebar 'sidebarWithConflicts', linking to the doc doc4",
|
||||
"message": "COMMON LABEL",
|
||||
},
|
||||
"sidebar.sidebarWithConflicts.doc.key-doc5": {
|
||||
"description": "The label for the doc item COMMON LABEL in sidebar sidebarWithConflicts, linking to the doc doc5",
|
||||
"description": "The label for the doc item 'COMMON LABEL' in sidebar 'sidebarWithConflicts', linking to the doc doc5",
|
||||
"message": "COMMON LABEL",
|
||||
},
|
||||
"sidebar.sidebarWithConflicts.doc.key-ref4": {
|
||||
"description": "The label for the doc item COMMON LABEL in sidebar sidebarWithConflicts, linking to the doc doc4",
|
||||
"description": "The label for the doc item 'COMMON LABEL' in sidebar 'sidebarWithConflicts', linking to the doc doc4",
|
||||
"message": "COMMON LABEL",
|
||||
},
|
||||
"sidebar.sidebarWithConflicts.doc.key-ref5": {
|
||||
"description": "The label for the doc item COMMON LABEL in sidebar sidebarWithConflicts, linking to the doc doc5",
|
||||
"description": "The label for the doc item 'COMMON LABEL' in sidebar 'sidebarWithConflicts', linking to the doc doc5",
|
||||
"message": "COMMON LABEL",
|
||||
},
|
||||
"sidebar.sidebarWithConflicts.link.key-link1": {
|
||||
"description": "The label for link COMMON LABEL in sidebar sidebarWithConflicts, linking to https://example.com",
|
||||
"description": "The label for link 'COMMON LABEL' in sidebar 'sidebarWithConflicts', linking to 'https://example.com'",
|
||||
"message": "COMMON LABEL",
|
||||
},
|
||||
"sidebar.sidebarWithConflicts.link.key-link2": {
|
||||
"description": "The label for link COMMON LABEL in sidebar sidebarWithConflicts, linking to https://example.com",
|
||||
"description": "The label for link 'COMMON LABEL' in sidebar 'sidebarWithConflicts', linking to 'https://example.com'",
|
||||
"message": "COMMON LABEL",
|
||||
},
|
||||
"version.label": {
|
||||
|
|
@ -279,18 +279,18 @@ describe('getLoadedContentTranslationFiles', () => {
|
|||
.toThrowErrorMatchingInlineSnapshot(`
|
||||
"Multiple docs sidebar items produce the same translation key.
|
||||
- \`sidebar.sidebarWithConflicts.category.COMMON LABEL\`: 2 duplicates found:
|
||||
- COMMON LABEL (The label for category COMMON LABEL in sidebar sidebarWithConflicts)
|
||||
- COMMON LABEL (The label for category COMMON LABEL in sidebar sidebarWithConflicts)
|
||||
- COMMON LABEL (The label for category 'COMMON LABEL' in sidebar 'sidebarWithConflicts')
|
||||
- COMMON LABEL (The label for category 'COMMON LABEL' in sidebar 'sidebarWithConflicts')
|
||||
|
||||
- \`sidebar.sidebarWithConflicts.link.COMMON LABEL\`: 2 duplicates found:
|
||||
- COMMON LABEL (The label for link COMMON LABEL in sidebar sidebarWithConflicts, linking to https://example.com)
|
||||
- COMMON LABEL (The label for link COMMON LABEL in sidebar sidebarWithConflicts, linking to https://example.com)
|
||||
- COMMON LABEL (The label for link 'COMMON LABEL' in sidebar 'sidebarWithConflicts', linking to 'https://example.com')
|
||||
- COMMON LABEL (The label for link 'COMMON LABEL' in sidebar 'sidebarWithConflicts', linking to 'https://example.com')
|
||||
|
||||
- \`sidebar.sidebarWithConflicts.doc.COMMON LABEL\`: 4 duplicates found:
|
||||
- COMMON LABEL (The label for the doc item COMMON LABEL in sidebar sidebarWithConflicts, linking to the doc doc4)
|
||||
- COMMON LABEL (The label for the doc item COMMON LABEL in sidebar sidebarWithConflicts, linking to the doc doc5)
|
||||
- COMMON LABEL (The label for the doc item COMMON LABEL in sidebar sidebarWithConflicts, linking to the doc doc4)
|
||||
- COMMON LABEL (The label for the doc item COMMON LABEL in sidebar sidebarWithConflicts, linking to the doc doc5)
|
||||
- COMMON LABEL (The label for the doc item 'COMMON LABEL' in sidebar 'sidebarWithConflicts', linking to the doc doc4)
|
||||
- COMMON LABEL (The label for the doc item 'COMMON LABEL' in sidebar 'sidebarWithConflicts', linking to the doc doc5)
|
||||
- COMMON LABEL (The label for the doc item 'COMMON LABEL' in sidebar 'sidebarWithConflicts', linking to the doc doc4)
|
||||
- COMMON LABEL (The label for the doc item 'COMMON LABEL' in sidebar 'sidebarWithConflicts', linking to the doc doc5)
|
||||
|
||||
To avoid translation key conflicts, use the \`key\` attribute on the sidebar items above to uniquely identify them.
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ function getSidebarTranslationFileContent(
|
|||
`sidebar.${sidebarName}.category.${categoryKey}`,
|
||||
{
|
||||
message: category.label,
|
||||
description: `The label for category ${category.label} in sidebar ${sidebarName}`,
|
||||
description: `The label for category '${category.label}' in sidebar '${sidebarName}'`,
|
||||
},
|
||||
]);
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ function getSidebarTranslationFileContent(
|
|||
`sidebar.${sidebarName}.category.${categoryKey}.link.generated-index.title`,
|
||||
{
|
||||
message: category.link.title,
|
||||
description: `The generated-index page title for category ${category.label} in sidebar ${sidebarName}`,
|
||||
description: `The generated-index page title for category '${category.label}' in sidebar '${sidebarName}'`,
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ function getSidebarTranslationFileContent(
|
|||
`sidebar.${sidebarName}.category.${categoryKey}.link.generated-index.description`,
|
||||
{
|
||||
message: category.link.description,
|
||||
description: `The generated-index page description for category ${category.label} in sidebar ${sidebarName}`,
|
||||
description: `The generated-index page description for category '${category.label}' in sidebar '${sidebarName}'`,
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
|
@ -135,7 +135,7 @@ function getSidebarTranslationFileContent(
|
|||
`sidebar.${sidebarName}.link.${linkKey}`,
|
||||
{
|
||||
message: link.label,
|
||||
description: `The label for link ${link.label} in sidebar ${sidebarName}, linking to ${link.href}`,
|
||||
description: `The label for link '${link.label}' in sidebar '${sidebarName}', linking to '${link.href}'`,
|
||||
},
|
||||
];
|
||||
});
|
||||
|
|
@ -149,7 +149,7 @@ function getSidebarTranslationFileContent(
|
|||
`sidebar.${sidebarName}.doc.${docKey}`,
|
||||
{
|
||||
message: doc.label!,
|
||||
description: `The label for the doc item ${doc.label!} in sidebar ${sidebarName}, linking to the doc ${
|
||||
description: `The label for the doc item '${doc.label!}' in sidebar '${sidebarName}', linking to the doc ${
|
||||
doc.id
|
||||
}`,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue