generaltranslation 2.0.13 → 2.0.14

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.
@@ -42,7 +42,9 @@ function _isValidLanguageCode(code) {
42
42
  return false;
43
43
  try {
44
44
  const locale = new Intl.Locale(code);
45
- return locale.baseName === code; // The baseName includes only the canonical language, script, and region
45
+ const { language, script, region } = locale;
46
+ const constructedCode = `${language}${script ? '-' + script : ''}${region ? '-' + region : ''}`;
47
+ return constructedCode === code;
46
48
  }
47
49
  catch (error) {
48
50
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generaltranslation",
3
- "version": "2.0.13",
3
+ "version": "2.0.14",
4
4
  "description": "A language toolkit for AI developers",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {