@docusaurus/theme-classic 0.0.0-4556 → 0.0.0-4561
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/translations.js +20 -26
- package/package.json +15 -17
package/lib/translations.js
CHANGED
|
@@ -20,9 +20,7 @@ function getNavbarTranslationFile(navbar) {
|
|
|
20
20
|
// TODO handle properly all the navbar item types here!
|
|
21
21
|
function flattenNavbarItems(items) {
|
|
22
22
|
const subItems = items.flatMap(item => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const allSubItems = [(_item$items = item.items) !== null && _item$items !== void 0 ? _item$items : []].flat();
|
|
23
|
+
const allSubItems = [item.items ?? []].flat();
|
|
26
24
|
return flattenNavbarItems(allSubItems);
|
|
27
25
|
});
|
|
28
26
|
return [...items, ...subItems];
|
|
@@ -43,23 +41,23 @@ function getNavbarTranslationFile(navbar) {
|
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
function translateNavbar(navbar, navbarTranslations) {
|
|
46
|
-
var _navbarTranslations$t
|
|
44
|
+
var _navbarTranslations$t;
|
|
47
45
|
|
|
48
46
|
return { ...navbar,
|
|
49
|
-
title: (_navbarTranslations$t =
|
|
47
|
+
title: ((_navbarTranslations$t = navbarTranslations.title) === null || _navbarTranslations$t === void 0 ? void 0 : _navbarTranslations$t.message) ?? navbar.title,
|
|
50
48
|
// TODO handle properly all the navbar item types here!
|
|
51
49
|
items: navbar.items.map(item => {
|
|
52
|
-
var _item$
|
|
50
|
+
var _item$items, _navbarTranslations$2;
|
|
53
51
|
|
|
54
|
-
const subItems = (_item$
|
|
55
|
-
var _navbarTranslations
|
|
52
|
+
const subItems = (_item$items = item.items) === null || _item$items === void 0 ? void 0 : _item$items.map(subItem => {
|
|
53
|
+
var _navbarTranslations$;
|
|
56
54
|
|
|
57
55
|
return { ...subItem,
|
|
58
|
-
label: (
|
|
56
|
+
label: ((_navbarTranslations$ = navbarTranslations[`item.label.${subItem.label}`]) === null || _navbarTranslations$ === void 0 ? void 0 : _navbarTranslations$.message) ?? subItem.label
|
|
59
57
|
};
|
|
60
58
|
});
|
|
61
59
|
return { ...item,
|
|
62
|
-
label: (
|
|
60
|
+
label: ((_navbarTranslations$2 = navbarTranslations[`item.label.${item.label}`]) === null || _navbarTranslations$2 === void 0 ? void 0 : _navbarTranslations$2.message) ?? item.label,
|
|
63
61
|
...(subItems ? {
|
|
64
62
|
items: subItems
|
|
65
63
|
} : undefined)
|
|
@@ -77,14 +75,10 @@ function getFooterTranslationFile(footer) {
|
|
|
77
75
|
message: link.title,
|
|
78
76
|
description: `The title of the footer links column with title=${link.title} in the footer`
|
|
79
77
|
})).value();
|
|
80
|
-
const footerLinkLabels = (0, _lodash.chain)(isMultiColumnFooterLinks(footer.links) ? footer.links.flatMap(link => link.items).filter(link => !!link.label) : footer.links.filter(link => !!link.label)).keyBy(linkItem => `link.item.label.${linkItem.label}`).mapValues(linkItem => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
message: linkItem.label,
|
|
85
|
-
description: `The label of footer link with label=${linkItem.label} linking to ${(_linkItem$to = linkItem.to) !== null && _linkItem$to !== void 0 ? _linkItem$to : linkItem.href}`
|
|
86
|
-
};
|
|
87
|
-
}).value();
|
|
78
|
+
const footerLinkLabels = (0, _lodash.chain)(isMultiColumnFooterLinks(footer.links) ? footer.links.flatMap(link => link.items).filter(link => !!link.label) : footer.links.filter(link => !!link.label)).keyBy(linkItem => `link.item.label.${linkItem.label}`).mapValues(linkItem => ({
|
|
79
|
+
message: linkItem.label,
|
|
80
|
+
description: `The label of footer link with label=${linkItem.label} linking to ${linkItem.to ?? linkItem.href}`
|
|
81
|
+
})).value();
|
|
88
82
|
const copyright = footer.copyright ? {
|
|
89
83
|
copyright: {
|
|
90
84
|
message: footer.copyright,
|
|
@@ -95,29 +89,29 @@ function getFooterTranslationFile(footer) {
|
|
|
95
89
|
}
|
|
96
90
|
|
|
97
91
|
function translateFooter(footer, footerTranslations) {
|
|
98
|
-
var _footerTranslations$c
|
|
92
|
+
var _footerTranslations$c;
|
|
99
93
|
|
|
100
94
|
const links = isMultiColumnFooterLinks(footer.links) ? footer.links.map(link => {
|
|
101
|
-
var _footerTranslations
|
|
95
|
+
var _footerTranslations$;
|
|
102
96
|
|
|
103
97
|
return { ...link,
|
|
104
|
-
title: (
|
|
98
|
+
title: ((_footerTranslations$ = footerTranslations[`link.title.${link.title}`]) === null || _footerTranslations$ === void 0 ? void 0 : _footerTranslations$.message) ?? link.title,
|
|
105
99
|
items: link.items.map(linkItem => {
|
|
106
|
-
var _footerTranslations
|
|
100
|
+
var _footerTranslations$2;
|
|
107
101
|
|
|
108
102
|
return { ...linkItem,
|
|
109
|
-
label: (
|
|
103
|
+
label: ((_footerTranslations$2 = footerTranslations[`link.item.label.${linkItem.label}`]) === null || _footerTranslations$2 === void 0 ? void 0 : _footerTranslations$2.message) ?? linkItem.label
|
|
110
104
|
};
|
|
111
105
|
})
|
|
112
106
|
};
|
|
113
107
|
}) : footer.links.map(link => {
|
|
114
|
-
var _footerTranslations
|
|
108
|
+
var _footerTranslations$3;
|
|
115
109
|
|
|
116
110
|
return { ...link,
|
|
117
|
-
label: (
|
|
111
|
+
label: ((_footerTranslations$3 = footerTranslations[`link.item.label.${link.label}`]) === null || _footerTranslations$3 === void 0 ? void 0 : _footerTranslations$3.message) ?? link.label
|
|
118
112
|
};
|
|
119
113
|
});
|
|
120
|
-
const copyright = (_footerTranslations$c =
|
|
114
|
+
const copyright = ((_footerTranslations$c = footerTranslations.copyright) === null || _footerTranslations$c === void 0 ? void 0 : _footerTranslations$c.message) ?? footer.copyright;
|
|
121
115
|
return { ...footer,
|
|
122
116
|
links,
|
|
123
117
|
copyright
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4561",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
"format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@docusaurus/core": "0.0.0-
|
|
25
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
26
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
28
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
29
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
30
|
-
"@docusaurus/utils": "0.0.0-
|
|
31
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
32
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
33
|
-
"@mdx-js/react": "^1.6.
|
|
24
|
+
"@docusaurus/core": "0.0.0-4561",
|
|
25
|
+
"@docusaurus/plugin-content-blog": "0.0.0-4561",
|
|
26
|
+
"@docusaurus/plugin-content-docs": "0.0.0-4561",
|
|
27
|
+
"@docusaurus/plugin-content-pages": "0.0.0-4561",
|
|
28
|
+
"@docusaurus/theme-common": "0.0.0-4561",
|
|
29
|
+
"@docusaurus/theme-translations": "0.0.0-4561",
|
|
30
|
+
"@docusaurus/utils": "0.0.0-4561",
|
|
31
|
+
"@docusaurus/utils-common": "0.0.0-4561",
|
|
32
|
+
"@docusaurus/utils-validation": "0.0.0-4561",
|
|
33
|
+
"@mdx-js/react": "^1.6.22",
|
|
34
34
|
"clsx": "^1.1.1",
|
|
35
35
|
"copy-text-to-clipboard": "^3.0.1",
|
|
36
36
|
"infima": "0.2.0-alpha.37",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"rtlcss": "^3.3.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
46
|
-
"@docusaurus/types": "0.0.0-
|
|
45
|
+
"@docusaurus/module-type-aliases": "0.0.0-4561",
|
|
46
|
+
"@docusaurus/types": "0.0.0-4561",
|
|
47
47
|
"@types/mdx-js__react": "^1.5.4",
|
|
48
48
|
"@types/parse-numeric-range": "^0.0.1",
|
|
49
49
|
"@types/prismjs": "^1.26.0",
|
|
@@ -54,13 +54,11 @@
|
|
|
54
54
|
"utility-types": "^3.10.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@babel/core": "^7.0.0",
|
|
58
57
|
"react": "^16.8.4 || ^17.0.0",
|
|
59
|
-
"react-dom": "^16.8.4 || ^17.0.0"
|
|
60
|
-
"webpack": "^5.0.0"
|
|
58
|
+
"react-dom": "^16.8.4 || ^17.0.0"
|
|
61
59
|
},
|
|
62
60
|
"engines": {
|
|
63
61
|
"node": ">=14"
|
|
64
62
|
},
|
|
65
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "d3f1df862e0e65e8427f9ed6e09e80eac7aff3cd"
|
|
66
64
|
}
|