fix(content-docs): allow translating doc labels in sidebars.js (#7634)

This commit is contained in:
Joshua Chen 2022-06-16 22:11:21 +08:00 committed by GitHub
parent 5fe33bef06
commit 20e8e90762
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 159 additions and 6 deletions

View file

@ -16,10 +16,18 @@ exports[`getLoadedContentTranslationFiles returns translation files 1`] = `
"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",
"message": "Second doc translatable",
},
"sidebar.docs.link.Link label": {
"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",
"message": "Fifth doc translatable",
},
"version.label": {
"description": "The label for version current",
"message": "current label",
@ -41,10 +49,18 @@ exports[`getLoadedContentTranslationFiles returns translation files 1`] = `
"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",
"message": "Second doc translatable",
},
"sidebar.docs.link.Link label": {
"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",
"message": "Fifth doc translatable",
},
"version.label": {
"description": "The label for version 2.0.0",
"message": "2.0.0 label",
@ -66,10 +82,18 @@ exports[`getLoadedContentTranslationFiles returns translation files 1`] = `
"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",
"message": "Second doc translatable",
},
"sidebar.docs.link.Link label": {
"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",
"message": "Fifth doc translatable",
},
"version.label": {
"description": "The label for version 1.0.0",
"message": "1.0.0 label",
@ -214,6 +238,8 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
},
{
"id": "doc2",
"label": "Second doc translatable (translated)",
"translatable": true,
"type": "doc",
},
{
@ -248,7 +274,9 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
},
{
"id": "doc5",
"type": "doc",
"label": "Fifth doc translatable (translated)",
"translatable": true,
"type": "ref",
},
],
},
@ -386,6 +414,8 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
},
{
"id": "doc2",
"label": "Second doc translatable (translated)",
"translatable": true,
"type": "doc",
},
{
@ -420,7 +450,9 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
},
{
"id": "doc5",
"type": "doc",
"label": "Fifth doc translatable (translated)",
"translatable": true,
"type": "ref",
},
],
},
@ -558,6 +590,8 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
},
{
"id": "doc2",
"label": "Second doc translatable (translated)",
"translatable": true,
"type": "doc",
},
{
@ -592,7 +626,9 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
},
{
"id": "doc5",
"type": "doc",
"label": "Fifth doc translatable (translated)",
"translatable": true,
"type": "ref",
},
],
},

View file

@ -86,6 +86,8 @@ function createSampleVersion(
{
type: 'doc',
id: 'doc2',
label: 'Second doc translatable',
translatable: true,
},
{
type: 'link',
@ -109,8 +111,10 @@ function createSampleVersion(
id: 'doc4',
},
{
type: 'doc',
type: 'ref',
id: 'doc5',
label: 'Fifth doc translatable',
translatable: true,
},
],
},