@docusaurus/core 3.10.0 → 3.10.1
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/server/i18n.d.ts +1 -1
- package/lib/server/i18n.js +13 -6
- package/package.json +11 -11
package/lib/server/i18n.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { I18n, DocusaurusConfig, I18nLocaleConfig, I18nConfig } from '@docusaurus/types';
|
|
8
|
-
export declare function getDefaultLocaleConfig(locale: string): Omit<I18nLocaleConfig, 'translate' | 'url' | 'baseUrl'>;
|
|
8
|
+
export declare function getDefaultLocaleConfig(locale: string, htmlLang?: string): Omit<I18nLocaleConfig, 'translate' | 'url' | 'baseUrl'>;
|
|
9
9
|
export declare function getLocaleList({ i18nConfig, currentLocale, }: {
|
|
10
10
|
i18nConfig: I18nConfig;
|
|
11
11
|
currentLocale: string;
|
package/lib/server/i18n.js
CHANGED
|
@@ -70,13 +70,20 @@ function getDefaultDirection(localeStr) {
|
|
|
70
70
|
const textInto = locale.getTextInfo?.() ?? locale.textInfo;
|
|
71
71
|
return textInto.direction ?? 'ltr';
|
|
72
72
|
}
|
|
73
|
-
function getDefaultLocaleConfig(
|
|
73
|
+
function getDefaultLocaleConfig(
|
|
74
|
+
// Locale "key/identifier"
|
|
75
|
+
// Can be anything, but usually a country / BCP47 code
|
|
76
|
+
locale,
|
|
77
|
+
// optionally provided in i18n.localConfigs, need to respect BCP47
|
|
78
|
+
htmlLang) {
|
|
74
79
|
try {
|
|
75
80
|
return {
|
|
76
|
-
label: getDefaultLocaleLabel(locale),
|
|
77
|
-
direction: getDefaultDirection(locale),
|
|
78
|
-
htmlLang: locale,
|
|
79
|
-
calendar: getDefaultCalendar(locale),
|
|
81
|
+
label: getDefaultLocaleLabel(htmlLang ?? locale),
|
|
82
|
+
direction: getDefaultDirection(htmlLang ?? locale),
|
|
83
|
+
htmlLang: htmlLang ?? locale,
|
|
84
|
+
calendar: getDefaultCalendar(htmlLang ?? locale),
|
|
85
|
+
// Fot the i18n/<path>, we don't use htmlLang on purpose
|
|
86
|
+
// see bug https://github.com/facebook/docusaurus/issues/11952
|
|
80
87
|
path: locale,
|
|
81
88
|
};
|
|
82
89
|
}
|
|
@@ -103,7 +110,7 @@ async function loadI18n({ siteDir, config, currentLocale, automaticBaseUrlLocali
|
|
|
103
110
|
async function getFullLocaleConfig(locale) {
|
|
104
111
|
const localeConfigInput = i18nConfig.localeConfigs[locale] ?? {};
|
|
105
112
|
const localeConfig = {
|
|
106
|
-
...getDefaultLocaleConfig(localeConfigInput.htmlLang
|
|
113
|
+
...getDefaultLocaleConfig(locale, localeConfigInput.htmlLang),
|
|
107
114
|
...localeConfigInput,
|
|
108
115
|
};
|
|
109
116
|
// By default, translations will be enabled if i18n/<locale> dir exists
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/core",
|
|
3
3
|
"description": "Easy to Maintain Open Source Documentation Websites",
|
|
4
|
-
"version": "3.10.
|
|
4
|
+
"version": "3.10.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"url": "https://github.com/facebook/docusaurus/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@docusaurus/babel": "3.10.
|
|
37
|
-
"@docusaurus/bundler": "3.10.
|
|
38
|
-
"@docusaurus/logger": "3.10.
|
|
39
|
-
"@docusaurus/mdx-loader": "3.10.
|
|
40
|
-
"@docusaurus/utils": "3.10.
|
|
41
|
-
"@docusaurus/utils-common": "3.10.
|
|
42
|
-
"@docusaurus/utils-validation": "3.10.
|
|
36
|
+
"@docusaurus/babel": "3.10.1",
|
|
37
|
+
"@docusaurus/bundler": "3.10.1",
|
|
38
|
+
"@docusaurus/logger": "3.10.1",
|
|
39
|
+
"@docusaurus/mdx-loader": "3.10.1",
|
|
40
|
+
"@docusaurus/utils": "3.10.1",
|
|
41
|
+
"@docusaurus/utils-common": "3.10.1",
|
|
42
|
+
"@docusaurus/utils-validation": "3.10.1",
|
|
43
43
|
"boxen": "^6.2.1",
|
|
44
44
|
"chalk": "^4.1.2",
|
|
45
45
|
"chokidar": "^3.5.3",
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
"webpack-merge": "^6.0.1"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@docusaurus/module-type-aliases": "3.10.
|
|
81
|
-
"@docusaurus/types": "3.10.
|
|
80
|
+
"@docusaurus/module-type-aliases": "3.10.1",
|
|
81
|
+
"@docusaurus/types": "3.10.1",
|
|
82
82
|
"@total-typescript/shoehorn": "^0.1.2",
|
|
83
83
|
"@types/detect-port": "^1.3.3",
|
|
84
84
|
"@types/react-dom": "^19.2.3",
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"engines": {
|
|
105
105
|
"node": ">=20.0"
|
|
106
106
|
},
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "41c1a458ecb07d61b6df2761ea4bc1b13db49d12"
|
|
108
108
|
}
|