generaltranslation 2.0.68 → 2.0.70

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,10 +15,23 @@ var libraryDefaultLanguage_1 = __importDefault(require("../settings/libraryDefau
15
15
  */
16
16
  var _isValidLanguageCode = function (code) {
17
17
  try {
18
- var displayNames = new Intl.DisplayNames([libraryDefaultLanguage_1.default], { type: 'language' });
19
- return displayNames.of(code) !== code;
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 (_a) {
34
+ catch (_b) {
22
35
  return false;
23
36
  }
24
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generaltranslation",
3
- "version": "2.0.68",
3
+ "version": "2.0.70",
4
4
  "description": "A language toolkit for AI developers",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",