generaltranslation 2.0.69 → 2.0.70
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/codes/codes.js +16 -3
- package/package.json +1 -1
package/dist/codes/codes.js
CHANGED
@@ -15,10 +15,23 @@ var libraryDefaultLanguage_1 = __importDefault(require("../settings/libraryDefau
|
|
15
15
|
*/
|
16
16
|
var _isValidLanguageCode = function (code) {
|
17
17
|
try {
|
18
|
-
var
|
19
|
-
|
18
|
+
var _a = new Intl.Locale(code), language = _a.language, region = _a.region, script = _a.script;
|
19
|
+
var displayLanguageNames = new Intl.DisplayNames([libraryDefaultLanguage_1.default], { type: 'language' });
|
20
|
+
if (displayLanguageNames.of(language) === language)
|
21
|
+
return false;
|
22
|
+
if (region) {
|
23
|
+
var displayRegionNames = new Intl.DisplayNames([libraryDefaultLanguage_1.default], { type: 'region' });
|
24
|
+
if (displayRegionNames.of(region) === region)
|
25
|
+
return false;
|
26
|
+
}
|
27
|
+
if (script) {
|
28
|
+
var displayScriptNames = new Intl.DisplayNames([libraryDefaultLanguage_1.default], { type: 'script' });
|
29
|
+
if (displayScriptNames.of(script) === script)
|
30
|
+
return false;
|
31
|
+
}
|
32
|
+
return true;
|
20
33
|
}
|
21
|
-
catch (
|
34
|
+
catch (_b) {
|
22
35
|
return false;
|
23
36
|
}
|
24
37
|
};
|