ilib-localematcher 1.3.1 → 1.3.4
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/README.md +2 -41
- package/lib/LocaleMatcher.js +1 -1
- package/lib/LocaleMatcher.js.map +1 -1
- package/lib/localematch.js +1 -1
- package/lib/localematch.js.map +1 -1
- package/package.json +110 -108
- package/src/LocaleMatcher.js +7 -7
- package/src/localematch.js +7 -1
- package/docs/LocaleMatcher.html +0 -1237
- package/docs/LocaleMatcher.js.html +0 -465
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -978
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -1049
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/ilibLocaleMatcher.md +0 -235
- package/docs/index.html +0 -84
- package/docs/scripts/collapse.js +0 -39
- package/docs/scripts/commonNav.js +0 -28
- package/docs/scripts/linenumber.js +0 -25
- package/docs/scripts/nav.js +0 -12
- package/docs/scripts/polyfill.js +0 -4
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/scripts/prettify/lang-css.js +0 -2
- package/docs/scripts/prettify/prettify.js +0 -28
- package/docs/scripts/search.js +0 -99
- package/docs/styles/jsdoc.css +0 -776
- package/docs/styles/prettify.css +0 -80
- package/lib/package.json +0 -1
package/package.json
CHANGED
|
@@ -1,111 +1,113 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"name": "Goun Lee",
|
|
42
|
-
"email": "goun.lee@lge.com"
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"files": [
|
|
46
|
-
"src",
|
|
47
|
-
"lib",
|
|
48
|
-
"docs",
|
|
49
|
-
"README.md",
|
|
50
|
-
"LICENSE"
|
|
51
|
-
],
|
|
52
|
-
"repository": {
|
|
53
|
-
"type": "git",
|
|
54
|
-
"url": "git@github.com:iLib-js/iLib-localematcher.git"
|
|
55
|
-
},
|
|
56
|
-
"scripts": {
|
|
57
|
-
"build": "npm run build:prod",
|
|
58
|
-
"build:prod": "grunt babel --mode=prod",
|
|
59
|
-
"build:dev": "grunt babel --mode=dev",
|
|
60
|
-
"build:test": "webpack-cli --config webpack-test.config.js",
|
|
61
|
-
"build:pkg": "echo '{\"type\": \"commonjs\"}' > lib/package.json",
|
|
62
|
-
"build:data": "node scripts/genlikelyloc.js",
|
|
63
|
-
"dist": "npm-run-all build:data doc doc:html build:prod build:pkg; npm pack",
|
|
64
|
-
"test": "npm run test:all",
|
|
65
|
-
"test:cli": "LANG=en_US.UTF8 npm run build:dev ; node --experimental-vm-modules node_modules/.bin/jest --testEnvironment node",
|
|
66
|
-
"test:web": "LANG=en_US.UTF8 node --experimental-vm-modules node_modules/.bin/karma start --reporters dots --single-run",
|
|
67
|
-
"test:watch": "LANG=en_US.UTF8 node --experimental-vm-modules node_modules/.bin/jest --testEnvironment node --watch",
|
|
68
|
-
"test:all": "npm-run-all test:cli test:web",
|
|
69
|
-
"debug": "npm run build:dev ; node --experimental-vm-modules --inspect-brk node_modules/.bin/jest --testEnvironment node -i",
|
|
70
|
-
"debug:web": "LANG=en_US.UTF8 node --experimental-vm-modules node_modules/.bin/karma start --reporters dots",
|
|
71
|
-
"clean": "git clean -f -d src test; rm -rf lib/*",
|
|
72
|
-
"doc": "mkdir -p docs ; jsdoc2md -c jsdoc.json --separators --source src/* -m table > docs/ilibLocaleMatcher.md",
|
|
73
|
-
"doc:html": "jsdoc -c jsdoc.json"
|
|
74
|
-
},
|
|
75
|
-
"devDependencies": {
|
|
76
|
-
"@babel/core": "^7.23.5",
|
|
77
|
-
"@babel/preset-env": "^7.23.5",
|
|
78
|
-
"@babel/register": "^7.22.15",
|
|
79
|
-
"@babel/runtime": "^7.23.5",
|
|
80
|
-
"babel-loader": "^8.3.0",
|
|
81
|
-
"babel-plugin-add-module-exports": "^1.0.4",
|
|
82
|
-
"babel-plugin-module-resolver": "^5.0.0",
|
|
83
|
-
"cldr-core": "^44.0.1",
|
|
84
|
-
"docdash": "^2.0.2",
|
|
85
|
-
"expect": "^29.7.0",
|
|
86
|
-
"grunt": "^1.6.1",
|
|
87
|
-
"grunt-babel": "^8.0.0",
|
|
88
|
-
"grunt-cli": "^1.4.3",
|
|
89
|
-
"grunt-contrib-clean": "^2.0.1",
|
|
90
|
-
"grunt-contrib-jshint": "^3.2.0",
|
|
91
|
-
"grunt-contrib-nodeunit": "^5.0.0",
|
|
92
|
-
"grunt-contrib-uglify": "^5.2.2",
|
|
93
|
-
"jest": "^26.6.3",
|
|
94
|
-
"jest-mock": "^29.7.0",
|
|
95
|
-
"jsdoc": "^4.0.2",
|
|
96
|
-
"jsdoc-to-markdown": "^8.0.0",
|
|
97
|
-
"karma": "^6.4.2",
|
|
98
|
-
"karma-assert": "^1.0.1",
|
|
99
|
-
"karma-chrome-launcher": "^3.2.0",
|
|
100
|
-
"karma-jasmine": "^5.1.0",
|
|
101
|
-
"karma-webpack": "^5.0.0",
|
|
102
|
-
"load-grunt-tasks": "^5.1.0",
|
|
103
|
-
"npm-run-all": "^4.1.5",
|
|
104
|
-
"webpack": "^5.89.0",
|
|
105
|
-
"webpack-cli": "^5.1.4"
|
|
2
|
+
"name": "ilib-localematcher",
|
|
3
|
+
"version": "1.3.4",
|
|
4
|
+
"main": "./lib/LocaleMatcher.js",
|
|
5
|
+
"module": "./src/LocaleMatcher.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./src/LocaleMatcher.js",
|
|
9
|
+
"require": "./lib/LocaleMatcher.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"description": "A locale matcher to resolve partial locales or find fallback locales. iLib is a cross-engine library of internationalization (i18n) classes written in pure JS",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"internationalization",
|
|
15
|
+
"i18n",
|
|
16
|
+
"localization",
|
|
17
|
+
"l10n",
|
|
18
|
+
"globalization",
|
|
19
|
+
"g11n",
|
|
20
|
+
"date",
|
|
21
|
+
"time",
|
|
22
|
+
"format",
|
|
23
|
+
"locale",
|
|
24
|
+
"translation"
|
|
25
|
+
],
|
|
26
|
+
"homepage": "https://github.com/iLib-js/ilib-mono/blob/main/packages/ilib-localematcher",
|
|
27
|
+
"bugs": "https://github.com/iLib-js/ilib-localematcher/issues",
|
|
28
|
+
"email": "marketing@translationcircle.com",
|
|
29
|
+
"license": "Apache-2.0",
|
|
30
|
+
"author": {
|
|
31
|
+
"name": "Edwin Hoogerbeets",
|
|
32
|
+
"web": "http://www.translationcircle.com/",
|
|
33
|
+
"email": "edwin@translationcircle.com"
|
|
34
|
+
},
|
|
35
|
+
"contributors": [
|
|
36
|
+
{
|
|
37
|
+
"name": "Edwin Hoogerbeets",
|
|
38
|
+
"email": "ehoogerbeets@gmail.com"
|
|
106
39
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
40
|
+
{
|
|
41
|
+
"name": "Goun Lee",
|
|
42
|
+
"email": "goun.lee@lge.com"
|
|
110
43
|
}
|
|
111
|
-
|
|
44
|
+
],
|
|
45
|
+
"files": [
|
|
46
|
+
"src",
|
|
47
|
+
"lib",
|
|
48
|
+
"README.md",
|
|
49
|
+
"LICENSE"
|
|
50
|
+
],
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "https://github.com/iLib-js/ilib-mono"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=14 <23"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@babel/core": "^7.28.5",
|
|
60
|
+
"@babel/preset-env": "^7.28.5",
|
|
61
|
+
"@babel/register": "^7.28.3",
|
|
62
|
+
"@babel/runtime": "^7.28.4",
|
|
63
|
+
"babel-loader": "^8.4.1",
|
|
64
|
+
"babel-plugin-add-module-exports": "^1.0.4",
|
|
65
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
|
66
|
+
"cldr-core": "^44.1.0",
|
|
67
|
+
"docdash": "^2.0.2",
|
|
68
|
+
"expect": "^29.7.0",
|
|
69
|
+
"grunt": "^1.6.1",
|
|
70
|
+
"grunt-babel": "^8.0.0",
|
|
71
|
+
"grunt-cli": "^1.5.0",
|
|
72
|
+
"grunt-contrib-clean": "^2.0.1",
|
|
73
|
+
"grunt-contrib-jshint": "^3.2.0",
|
|
74
|
+
"grunt-contrib-uglify": "^5.2.2",
|
|
75
|
+
"jest": "^29.7.0",
|
|
76
|
+
"jest-mock": "^29.7.0",
|
|
77
|
+
"jsdoc": "^4.0.5",
|
|
78
|
+
"jsdoc-to-markdown": "^8.0.3",
|
|
79
|
+
"karma": "^6.4.4",
|
|
80
|
+
"karma-assert": "^1.0.1",
|
|
81
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
82
|
+
"karma-jasmine": "^5.1.0",
|
|
83
|
+
"karma-webpack": "^5.0.1",
|
|
84
|
+
"load-grunt-tasks": "^5.1.0",
|
|
85
|
+
"npm-run-all": "^4.1.5",
|
|
86
|
+
"webpack": "^5.102.1",
|
|
87
|
+
"webpack-cli": "^5.1.4"
|
|
88
|
+
},
|
|
89
|
+
"dependencies": {
|
|
90
|
+
"ilib-common": "^1.1.7",
|
|
91
|
+
"ilib-locale": "^1.4.0"
|
|
92
|
+
},
|
|
93
|
+
"scripts": {
|
|
94
|
+
"build": "pnpm run build:prod",
|
|
95
|
+
"build:prod": "grunt babel --mode=prod",
|
|
96
|
+
"build:dev": "grunt babel --mode=dev",
|
|
97
|
+
"build:test": "webpack-cli --config webpack-test.config.js",
|
|
98
|
+
"build:pkg": "echo '{\"type\": \"commonjs\"}' > lib/package.json",
|
|
99
|
+
"build:data": "node scripts/genlikelyloc.js",
|
|
100
|
+
"coverage": "pnpm test:cli --coverage",
|
|
101
|
+
"dist": "npm-run-all build:data doc doc:html build:prod build:pkg; npm pack",
|
|
102
|
+
"test": "pnpm test:all",
|
|
103
|
+
"test:cli": "LANG=en_US.UTF8 node --experimental-vm-modules node_modules/jest/bin/jest.js --testEnvironment node",
|
|
104
|
+
"test:web": "LANG=en_US.UTF8 node --experimental-vm-modules node_modules/karma/bin/karma start --reporters dots --single-run",
|
|
105
|
+
"test:watch": "LANG=en_US.UTF8 node --experimental-vm-modules node_modules/jest/bin/jest.js --testEnvironment node --watch",
|
|
106
|
+
"test:all": "npm-run-all --npm-path pnpm test:cli test:web",
|
|
107
|
+
"debug": "pnpm build:dev && node --experimental-vm-modules --inspect-brk node_modules/jest/bin/jest.js --testEnvironment node -i",
|
|
108
|
+
"debug:web": "LANG=en_US.UTF8 node --experimental-vm-modules node_modules/karma/bin/karma start --reporters dots",
|
|
109
|
+
"clean": "git clean -f -d src test&& rm -rf lib",
|
|
110
|
+
"doc": "mkdir -p docs ; jsdoc2md -c jsdoc.json --separators --source src/* -m table > docs/ilibLocaleMatcher.md",
|
|
111
|
+
"doc:html": "jsdoc -c jsdoc.json"
|
|
112
|
+
}
|
|
113
|
+
}
|
package/src/LocaleMatcher.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* LocaleMatcher.js - Locale matcher definition
|
|
3
3
|
*
|
|
4
|
-
* Copyright © 2013-2015, 2018-2019, 2021-2022 JEDLSoft
|
|
4
|
+
* Copyright © 2013-2015, 2018-2019, 2021-2022, 2026 JEDLSoft
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -91,22 +91,22 @@ class LocaleMatcher {
|
|
|
91
91
|
|
|
92
92
|
if (typeof(matchdata.likelyLocales[locale.getSpec()]) === 'undefined') {
|
|
93
93
|
// try various partials before giving up
|
|
94
|
-
let partial = matchdata.likelyLocales[new Locale(locale.language,
|
|
94
|
+
let partial = matchdata.likelyLocales[new Locale(locale.language, locale.region, undefined).getSpec()];
|
|
95
95
|
if (typeof(partial) !== 'undefined') return new Locale(partial);
|
|
96
96
|
|
|
97
|
-
partial = matchdata.likelyLocales[new Locale(locale.language, locale.script
|
|
97
|
+
partial = matchdata.likelyLocales[new Locale(locale.language, undefined, undefined, locale.script).getSpec()];
|
|
98
98
|
if (typeof(partial) !== 'undefined') return new Locale(partial);
|
|
99
99
|
|
|
100
100
|
partial = matchdata.likelyLocales[new Locale(locale.language, undefined, undefined).getSpec()];
|
|
101
101
|
if (typeof(partial) !== 'undefined') return new Locale(partial);
|
|
102
102
|
|
|
103
|
-
partial = matchdata.likelyLocales[new Locale(undefined, locale.
|
|
103
|
+
partial = matchdata.likelyLocales[new Locale(undefined, locale.region, undefined, locale.script).getSpec()];
|
|
104
104
|
if (typeof(partial) !== 'undefined') return new Locale(partial);
|
|
105
105
|
|
|
106
|
-
partial = matchdata.likelyLocales[new Locale(undefined,
|
|
106
|
+
partial = matchdata.likelyLocales[new Locale(undefined, locale.region, undefined).getSpec()];
|
|
107
107
|
if (typeof(partial) !== 'undefined') return new Locale(partial);
|
|
108
108
|
|
|
109
|
-
partial = matchdata.likelyLocales[new Locale(undefined, locale.script
|
|
109
|
+
partial = matchdata.likelyLocales[new Locale(undefined, undefined, undefined, locale.script).getSpec()];
|
|
110
110
|
if (typeof(partial) !== 'undefined') return new Locale(partial);
|
|
111
111
|
|
|
112
112
|
return locale;
|
|
@@ -161,7 +161,7 @@ class LocaleMatcher {
|
|
|
161
161
|
const fullLocale = this._getLikelyLocale(this.locale);
|
|
162
162
|
const langLocale = this._getLikelyLocale(new Locale(fullLocale.language));
|
|
163
163
|
return fullLocale.script === langLocale.script && !multiScriptLanguages[fullLocale.language] ?
|
|
164
|
-
new Locale(fullLocale.language,
|
|
164
|
+
new Locale(fullLocale.language, fullLocale.region, undefined) :
|
|
165
165
|
fullLocale;
|
|
166
166
|
}
|
|
167
167
|
|
package/src/localematch.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
* localematch.js - Locale match mappings
|
|
4
4
|
*
|
|
5
|
-
* Copyright © 2022-2023 JEDLSoft
|
|
5
|
+
* Copyright © 2022-2023, 2025-2026 JEDLSoft
|
|
6
6
|
*
|
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
8
|
* you may not use this file except in compliance with the License.
|
|
@@ -351,8 +351,11 @@ export const matchdata = {
|
|
|
351
351
|
"Kits": "zkt-Kits-CN",
|
|
352
352
|
"Knda": "kn-Knda-IN",
|
|
353
353
|
"Kore": "ko-Kore-KR",
|
|
354
|
+
"Kore-CN": "ko-Kore-CN",
|
|
354
355
|
"Kore-KP": "ko-Kore-KP",
|
|
355
356
|
"Kore-KR": "ko-Kore-KR",
|
|
357
|
+
"Kore-TW": "ko-Kore-TW",
|
|
358
|
+
"Kore-US": "ko-Kore-US",
|
|
356
359
|
"Kthi": "bho-Kthi-IN",
|
|
357
360
|
"LA": "lo-Laoo-LA",
|
|
358
361
|
"LB": "ar-Arab-LB",
|
|
@@ -9980,9 +9983,12 @@ export const matchdata = {
|
|
|
9980
9983
|
"knz-BF": "knz-Latn-BF",
|
|
9981
9984
|
"knz-Latn": "knz-Latn-BF",
|
|
9982
9985
|
"ko": "ko-Kore-KR",
|
|
9986
|
+
"ko-CN": "ko-Kore-CN",
|
|
9983
9987
|
"ko-KP": "ko-Kore-KP",
|
|
9984
9988
|
"ko-KR": "ko-Kore-KR",
|
|
9985
9989
|
"ko-Kore": "ko-Kore-KR",
|
|
9990
|
+
"ko-TW": "ko-Kore-TW",
|
|
9991
|
+
"ko-US": "ko-Kore-US",
|
|
9986
9992
|
"koa": "koa-Latn-PG",
|
|
9987
9993
|
"koa-Latn": "koa-Latn-PG",
|
|
9988
9994
|
"koa-PG": "koa-Latn-PG",
|