@docusaurus/theme-translations 0.0.0-4518 → 0.0.0-4524
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 +3 -5
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +3 -5
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,CAepE;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
|
@@ -16,8 +16,8 @@ function getDefaultLocalesDirPath() {
|
|
|
16
16
|
// Return an ordered list of locales we should try
|
|
17
17
|
function codeTranslationLocalesToTry(locale) {
|
|
18
18
|
const intlLocale = new Intl.Locale(locale);
|
|
19
|
-
// if locale is just a simple language like "pt", we want to fallback to pt-BR
|
|
20
|
-
//
|
|
19
|
+
// if locale is just a simple language like "pt", we want to fallback to pt-BR
|
|
20
|
+
// (not pt-PT!) See https://github.com/facebook/docusaurus/pull/4536#issuecomment-810088783
|
|
21
21
|
if (intlLocale.language === locale) {
|
|
22
22
|
const maximizedLocale = intlLocale.maximize(); // pt-Latn-BR`
|
|
23
23
|
// ["pt","pt-BR"]; ["zh", "zh-Hans"]
|
|
@@ -28,9 +28,7 @@ function codeTranslationLocalesToTry(locale) {
|
|
|
28
28
|
];
|
|
29
29
|
}
|
|
30
30
|
// if locale is like "pt-BR", we want to fallback to "pt"
|
|
31
|
-
|
|
32
|
-
return [locale, intlLocale.language];
|
|
33
|
-
}
|
|
31
|
+
return [locale, intlLocale.language];
|
|
34
32
|
}
|
|
35
33
|
exports.codeTranslationLocalesToTry = codeTranslationLocalesToTry;
|
|
36
34
|
// Useful to implement getDefaultCodeTranslationMessages() in themes
|
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,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3C,2FAA2F;IAC3F,
|
|
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,8EAA8E;IAC9E,2FAA2F;IAC3F,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;IACzD,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,QAAS,CAAC,CAAC;AACxC,CAAC;AAfD,kEAeC;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-4524",
|
|
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-4524",
|
|
27
|
+
"@docusaurus/logger": "0.0.0-4524",
|
|
28
28
|
"lodash": "^4.17.20"
|
|
29
29
|
},
|
|
30
30
|
"engines": {
|
|
31
31
|
"node": ">=14"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "41a6bff3a67446f7d2a2972cbe4d05fec7378a15"
|
|
34
34
|
}
|
package/src/index.ts
CHANGED
|
@@ -15,8 +15,8 @@ function getDefaultLocalesDirPath(): string {
|
|
|
15
15
|
// Return an ordered list of locales we should try
|
|
16
16
|
export function codeTranslationLocalesToTry(locale: string): string[] {
|
|
17
17
|
const intlLocale = new Intl.Locale(locale);
|
|
18
|
-
// if locale is just a simple language like "pt", we want to fallback to pt-BR
|
|
19
|
-
//
|
|
18
|
+
// if locale is just a simple language like "pt", we want to fallback to pt-BR
|
|
19
|
+
// (not pt-PT!) See https://github.com/facebook/docusaurus/pull/4536#issuecomment-810088783
|
|
20
20
|
if (intlLocale.language === locale) {
|
|
21
21
|
const maximizedLocale = intlLocale.maximize(); // pt-Latn-BR`
|
|
22
22
|
// ["pt","pt-BR"]; ["zh", "zh-Hans"]
|
|
@@ -27,9 +27,7 @@ export function codeTranslationLocalesToTry(locale: string): string[] {
|
|
|
27
27
|
];
|
|
28
28
|
}
|
|
29
29
|
// if locale is like "pt-BR", we want to fallback to "pt"
|
|
30
|
-
|
|
31
|
-
return [locale, intlLocale.language!];
|
|
32
|
-
}
|
|
30
|
+
return [locale, intlLocale.language!];
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
// Useful to implement getDefaultCodeTranslationMessages() in themes
|