File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6666 "react-router" : " ^5.3.4" ,
6767 "react-router-config" : " ^5.1.1" ,
6868 "react-router-dom" : " ^5.3.4" ,
69- "rtl-detect" : " ^1.0.4" ,
7069 "semver" : " ^7.5.4" ,
7170 "serve-handler" : " ^6.1.6" ,
7271 "shelljs" : " ^0.8.5" ,
8483 "@types/detect-port" : " ^1.3.3" ,
8584 "@types/react-dom" : " ^18.2.7" ,
8685 "@types/react-router-config" : " ^5.0.7" ,
87- "@types/rtl-detect" : " ^1.0.0" ,
8886 "@types/serve-handler" : " ^6.1.4" ,
8987 "@types/update-notifier" : " ^6.0.4" ,
9088 "@types/webpack-bundle-analyzer" : " ^4.7.0" ,
Original file line number Diff line number Diff line change 66 */
77
88import logger from '@docusaurus/logger' ;
9- import { getLangDir } from 'rtl-detect' ;
109import type { I18n , DocusaurusConfig , I18nLocaleConfig } from '@docusaurus/types' ;
1110import type { LoadContextParams } from './site' ;
1211
@@ -69,11 +68,21 @@ function getDefaultCalendar(localeStr: string) {
6968 return 'gregory' ;
7069}
7170
71+ function getDefaultDirection ( localeStr : string ) {
72+ const locale = new Intl . Locale ( localeStr ) ;
73+ // see https://github.com/tc39/proposal-intl-locale-info
74+ // see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
75+ // Node 18.0 implements a former version of the getTextInfo() proposal
76+ // @ts -expect-error: The TC39 proposal was updated
77+ const textInto = locale . getTextInfo ?.( ) ?? locale . textInfo ;
78+ return textInto . direction ;
79+ }
80+
7281export function getDefaultLocaleConfig ( locale : string ) : I18nLocaleConfig {
7382 try {
7483 return {
7584 label : getDefaultLocaleLabel ( locale ) ,
76- direction : getLangDir ( locale ) ,
85+ direction : getDefaultDirection ( locale ) ,
7786 htmlLang : locale ,
7887 calendar : getDefaultCalendar ( locale ) ,
7988 path : locale ,
Original file line number Diff line number Diff line change 42594259 resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.0.tgz#2b35eccfcee7d38cd72ad99232fbd58bffb3c84d"
42604260 integrity sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==
42614261
4262- "@types/rtl-detect@^1.0.0":
4263- version "1.0.3"
4264- resolved "https://registry.yarnpkg.com/@types/rtl-detect/-/rtl-detect-1.0.3.tgz#2b9849ece923d767712e95efa01ca75724de0de5"
4265- integrity sha512-qpstuHivwg/HoXxRrBo5/r/OVx5M2SkqJpVu2haasdLctt+jMGHWjqdbI0LL7Rk2wRmN/UHdHK4JZg9RUMcvKA==
4266-
42674262"@types/rtlcss@^3.5.1":
42684263 version "3.5.4"
42694264 resolved "https://registry.yarnpkg.com/@types/rtlcss/-/rtlcss-3.5.4.tgz#8db1e02fe911cf5b71f4cb42dafce8ccaef8e1e1"
@@ -15899,11 +15894,6 @@ rslog@^1.2.3:
1589915894 resolved "https://registry.yarnpkg.com/rslog/-/rslog-1.2.3.tgz#9114d93056312fbe35c11b3fea3f2774a7debe56"
1590015895 integrity sha512-antALPJaKBRPBU1X2q9t085K4htWDOOv/K1qhTUk7h0l1ePU/KbDqKJn19eKP0dk7PqMioeA0+fu3gyPXCsXxQ==
1590115896
15902- rtl-detect@^1.0.4:
15903- version "1.1.2"
15904- resolved "https://registry.yarnpkg.com/rtl-detect/-/rtl-detect-1.1.2.tgz#ca7f0330af5c6bb626c15675c642ba85ad6273c6"
15905- integrity sha512-PGMBq03+TTG/p/cRB7HCLKJ1MgDIi07+QU1faSjiYRfmY5UsAttV9Hs08jDAHVwcOwmVLcSJkpwyfXszVjWfIQ==
15906-
1590715897rtlcss@^4.1.0:
1590815898 version "4.3.0"
1590915899 resolved "https://registry.yarnpkg.com/rtlcss/-/rtlcss-4.3.0.tgz#f8efd4d5b64f640ec4af8fa25b65bacd9e07cc97"
You can’t perform that action at this time.
0 commit comments