@docusaurus/core 0.0.0-5838 → 0.0.0-5846

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.
Files changed (2) hide show
  1. package/lib/server/i18n.js +20 -2
  2. package/package.json +10 -10
@@ -14,13 +14,31 @@ function getDefaultLocaleLabel(locale) {
14
14
  const languageName = new Intl.DisplayNames(locale, { type: 'language' }).of(locale);
15
15
  return (languageName.charAt(0).toLocaleUpperCase(locale) + languageName.substring(1));
16
16
  }
17
+ function getDefaultCalendar(localeStr) {
18
+ const locale = new Intl.Locale(localeStr);
19
+ // If the locale name includes -u-ca-xxx the calendar will be defined
20
+ if (locale.calendar) {
21
+ return locale.calendar;
22
+ }
23
+ // Not well-supported but server code can infer a calendar from the locale
24
+ // See https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getCalendars
25
+ // See https://caniuse.com/mdn-javascript_builtins_intl_locale_getcalendars
26
+ const calendars =
27
+ // @ts-expect-error: new std method (Bun/JSC/WebKit)
28
+ locale.getCalendars?.() ??
29
+ // @ts-expect-error: non-std attribute (V8/Chromium/Node)
30
+ locale.calendars;
31
+ if (calendars instanceof Array && calendars[0]) {
32
+ return calendars[0];
33
+ }
34
+ return 'gregory';
35
+ }
17
36
  function getDefaultLocaleConfig(locale) {
18
37
  return {
19
38
  label: getDefaultLocaleLabel(locale),
20
39
  direction: (0, rtl_detect_1.getLangDir)(locale),
21
40
  htmlLang: locale,
22
- // If the locale name includes -u-ca-xxx the calendar will be defined
23
- calendar: new Intl.Locale(locale).calendar ?? 'gregory',
41
+ calendar: getDefaultCalendar(locale),
24
42
  path: locale,
25
43
  };
26
44
  }
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": "0.0.0-5838",
4
+ "version": "0.0.0-5846",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -43,13 +43,13 @@
43
43
  "@babel/runtime": "^7.22.6",
44
44
  "@babel/runtime-corejs3": "^7.22.6",
45
45
  "@babel/traverse": "^7.22.8",
46
- "@docusaurus/cssnano-preset": "0.0.0-5838",
47
- "@docusaurus/logger": "0.0.0-5838",
48
- "@docusaurus/mdx-loader": "0.0.0-5838",
46
+ "@docusaurus/cssnano-preset": "0.0.0-5846",
47
+ "@docusaurus/logger": "0.0.0-5846",
48
+ "@docusaurus/mdx-loader": "0.0.0-5846",
49
49
  "@docusaurus/react-loadable": "5.5.2",
50
- "@docusaurus/utils": "0.0.0-5838",
51
- "@docusaurus/utils-common": "0.0.0-5838",
52
- "@docusaurus/utils-validation": "0.0.0-5838",
50
+ "@docusaurus/utils": "0.0.0-5846",
51
+ "@docusaurus/utils-common": "0.0.0-5846",
52
+ "@docusaurus/utils-validation": "0.0.0-5846",
53
53
  "@svgr/webpack": "^6.5.1",
54
54
  "autoprefixer": "^10.4.14",
55
55
  "babel-loader": "^9.1.3",
@@ -105,8 +105,8 @@
105
105
  "webpackbar": "^5.0.2"
106
106
  },
107
107
  "devDependencies": {
108
- "@docusaurus/module-type-aliases": "0.0.0-5838",
109
- "@docusaurus/types": "0.0.0-5838",
108
+ "@docusaurus/module-type-aliases": "0.0.0-5846",
109
+ "@docusaurus/types": "0.0.0-5846",
110
110
  "@types/detect-port": "^1.3.3",
111
111
  "@types/react-dom": "^18.2.7",
112
112
  "@types/react-router-config": "^5.0.7",
@@ -125,5 +125,5 @@
125
125
  "engines": {
126
126
  "node": ">=18.0"
127
127
  },
128
- "gitHead": "9d51d009a6677ee7e2d1a8c8a0e31d70fc4cd5bd"
128
+ "gitHead": "3dd0ee8e670c2c89f785d221f36ac09ec90b6397"
129
129
  }