mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 02:08:55 +02:00
fix(content-docs): allow translating doc labels in sidebars.js (#7634)
This commit is contained in:
parent
5fe33bef06
commit
20e8e90762
9 changed files with 159 additions and 6 deletions
|
@ -1,5 +1,52 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`normalization adds a translatable marker for labels defined in sidebars.js 1`] = `
|
||||
{
|
||||
"sidebar": [
|
||||
{
|
||||
"id": "google",
|
||||
"label": "Google",
|
||||
"translatable": true,
|
||||
"type": "doc",
|
||||
},
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"id": "doc1",
|
||||
"type": "doc",
|
||||
},
|
||||
{
|
||||
"id": "doc2",
|
||||
"type": "doc",
|
||||
},
|
||||
],
|
||||
"label": "Category 1",
|
||||
"type": "category",
|
||||
},
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"id": "doc3",
|
||||
"type": "doc",
|
||||
},
|
||||
{
|
||||
"id": "doc4",
|
||||
"type": "doc",
|
||||
},
|
||||
{
|
||||
"id": "msft",
|
||||
"label": "Microsoft",
|
||||
"translatable": true,
|
||||
"type": "ref",
|
||||
},
|
||||
],
|
||||
"label": "Category 2",
|
||||
"type": "category",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`normalization normalizes shorthands 1`] = `
|
||||
{
|
||||
"sidebar": [
|
||||
|
|
|
@ -91,4 +91,30 @@ describe('normalization', () => {
|
|||
`"Invalid sidebar items collection \`"item"\` in sidebar sidebar: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a \`type\` property). See https://docusaurus.io/docs/sidebar/items for all valid syntaxes."`,
|
||||
);
|
||||
});
|
||||
|
||||
it('adds a translatable marker for labels defined in sidebars.js', () => {
|
||||
expect(
|
||||
normalizeSidebars({
|
||||
sidebar: [
|
||||
{
|
||||
type: 'doc',
|
||||
id: 'google',
|
||||
label: 'Google',
|
||||
},
|
||||
{
|
||||
'Category 1': ['doc1', 'doc2'],
|
||||
'Category 2': [
|
||||
'doc3',
|
||||
'doc4',
|
||||
{
|
||||
type: 'ref',
|
||||
id: 'msft',
|
||||
label: 'Microsoft',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue