@docusaurus/theme-translations 0.0.0-4428 → 0.0.0-4433
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/index.d.ts.map +1 -1
- package/lib/index.js +7 -6
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +7 -6
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBpE;AAGD,wBAAsB,kCAAkC,CAAC,EACvD,OAAoC,EACpC,MAAM,EACN,IAAI,GACL,EAAE;IACD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAgBlC"}
|
package/lib/index.js
CHANGED
|
@@ -15,16 +15,17 @@ function getDefaultLocalesDirPath() {
|
|
|
15
15
|
}
|
|
16
16
|
// Return an ordered list of locales we should try
|
|
17
17
|
function codeTranslationLocalesToTry(locale) {
|
|
18
|
-
const intlLocale =
|
|
19
|
-
if (!intlLocale) {
|
|
20
|
-
return [locale];
|
|
21
|
-
}
|
|
18
|
+
const intlLocale = new Intl.Locale(locale);
|
|
22
19
|
// if locale is just a simple language like "pt", we want to fallback to pt-BR (not pt-PT!)
|
|
23
20
|
// see https://github.com/facebook/docusaurus/pull/4536#issuecomment-810088783
|
|
24
21
|
if (intlLocale.language === locale) {
|
|
25
22
|
const maximizedLocale = intlLocale.maximize(); // pt-Latn-BR`
|
|
26
|
-
// ["pt","pt-BR"]
|
|
27
|
-
return [
|
|
23
|
+
// ["pt","pt-BR"]; ["zh", "zh-Hans"]
|
|
24
|
+
return [
|
|
25
|
+
locale,
|
|
26
|
+
`${maximizedLocale.language}-${maximizedLocale.region}`,
|
|
27
|
+
`${maximizedLocale.language}-${maximizedLocale.script}`,
|
|
28
|
+
];
|
|
28
29
|
}
|
|
29
30
|
// if locale is like "pt-BR", we want to fallback to "pt"
|
|
30
31
|
else {
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,6DAAwB;AACxB,qEAA0B;AAE1B,SAAS,wBAAwB;IAC/B,OAAO,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED,kDAAkD;AAClD,SAAgB,2BAA2B,CAAC,MAAc;IACxD,MAAM,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,6DAAwB;AACxB,qEAA0B;AAE1B,SAAS,wBAAwB;IAC/B,OAAO,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED,kDAAkD;AAClD,SAAgB,2BAA2B,CAAC,MAAc;IACxD,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3C,2FAA2F;IAC3F,8EAA8E;IAC9E,IAAI,UAAU,CAAC,QAAQ,KAAK,MAAM,EAAE;QAClC,MAAM,eAAe,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,cAAc;QAC7D,oCAAoC;QACpC,OAAO;YACL,MAAM;YACN,GAAG,eAAe,CAAC,QAAQ,IAAI,eAAe,CAAC,MAAM,EAAE;YACvD,GAAG,eAAe,CAAC,QAAQ,IAAI,eAAe,CAAC,MAAM,EAAE;SACxD,CAAC;KACH;IACD,yDAAyD;SACpD;QACH,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,QAAS,CAAC,CAAC;KACvC;AACH,CAAC;AAjBD,kEAiBC;AAED,oEAAoE;AAC7D,KAAK,UAAU,kCAAkC,CAAC,EACvD,OAAO,GAAG,wBAAwB,EAAE,EACpC,MAAM,EACN,IAAI,GAKL;IACC,MAAM,YAAY,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;IAEzD,kDAAkD;IAClD,mCAAmC;IACnC,gDAAgD;IAChD,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;QACtC,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,OAAO,CAAC,CAAC;QAEpE,IAAI,MAAM,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;YACjC,MAAM,WAAW,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACxD,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;SAChC;KACF;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAxBD,gFAwBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-translations",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4433",
|
|
4
4
|
"description": "Docusaurus theme translations.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"tslib": "^2.3.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@docusaurus/core": "0.0.0-
|
|
27
|
-
"@docusaurus/logger": "0.0.0-
|
|
26
|
+
"@docusaurus/core": "0.0.0-4433",
|
|
27
|
+
"@docusaurus/logger": "0.0.0-4433",
|
|
28
28
|
"lodash": "^4.17.20"
|
|
29
29
|
},
|
|
30
30
|
"engines": {
|
|
31
31
|
"node": ">=14"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "ffbadadb02dbb89e253b79dfb6c06609cae500b5"
|
|
34
34
|
}
|
package/src/index.ts
CHANGED
|
@@ -14,16 +14,17 @@ function getDefaultLocalesDirPath(): string {
|
|
|
14
14
|
|
|
15
15
|
// Return an ordered list of locales we should try
|
|
16
16
|
export function codeTranslationLocalesToTry(locale: string): string[] {
|
|
17
|
-
const intlLocale =
|
|
18
|
-
if (!intlLocale) {
|
|
19
|
-
return [locale];
|
|
20
|
-
}
|
|
17
|
+
const intlLocale = new Intl.Locale(locale);
|
|
21
18
|
// if locale is just a simple language like "pt", we want to fallback to pt-BR (not pt-PT!)
|
|
22
19
|
// see https://github.com/facebook/docusaurus/pull/4536#issuecomment-810088783
|
|
23
20
|
if (intlLocale.language === locale) {
|
|
24
21
|
const maximizedLocale = intlLocale.maximize(); // pt-Latn-BR`
|
|
25
|
-
// ["pt","pt-BR"]
|
|
26
|
-
return [
|
|
22
|
+
// ["pt","pt-BR"]; ["zh", "zh-Hans"]
|
|
23
|
+
return [
|
|
24
|
+
locale,
|
|
25
|
+
`${maximizedLocale.language}-${maximizedLocale.region}`,
|
|
26
|
+
`${maximizedLocale.language}-${maximizedLocale.script}`,
|
|
27
|
+
];
|
|
27
28
|
}
|
|
28
29
|
// if locale is like "pt-BR", we want to fallback to "pt"
|
|
29
30
|
else {
|