@formatjs/intl-displaynames 5.1.6 → 5.2.0
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/index.d.ts.map +1 -1
- package/index.js +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/should-polyfill.d.ts +1 -1
- package/lib/should-polyfill.d.ts.map +1 -1
- package/lib/should-polyfill.js +13 -2
- package/package.json +3 -2
- package/polyfill.iife.js +350 -197
- package/should-polyfill.d.ts +1 -1
- package/should-polyfill.d.ts.map +1 -1
- package/should-polyfill.js +13 -2
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-displaynames/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-displaynames/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,sBAAsB,EACtB,gBAAgB,EAIjB,MAAM,4BAA4B,CAAA;AAInC,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IACrC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;IACnC,IAAI,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAA;IACnD,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAA;IAChD,IAAI,EAAE,WAAW,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAA;IAC9C,QAAQ,EAAE,WAAW,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAA;CACvD;AAED,qBAAa,YAAY;gBAErB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EACtC,OAAO,EAAE,mBAAmB;IAmF9B,MAAM,CAAC,kBAAkB,CACvB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,eAAe,CAAC,GACnD,MAAM,EAAE;IAQX,MAAM,CAAC,eAAe,CAAC,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI;IAgB/D,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS;IA4DvE,eAAe,IAAI,2BAA2B;IAc9C,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,CAAK;IACpE,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAoB;IACnD,OAAO,CAAC,MAAM,CAAC,eAAe,CAAK;IACnC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAG/B,gBAAuB,UAAU,QAAO;CACzC"}
|
package/index.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.DisplayNames = void 0;
|
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
6
6
|
var CanonicalCodeForDisplayNames_1 = require("./abstract/CanonicalCodeForDisplayNames");
|
|
7
|
+
var intl_localematcher_1 = require("@formatjs/intl-localematcher");
|
|
7
8
|
var DisplayNames = /** @class */ (function () {
|
|
8
9
|
function DisplayNames(locales, options) {
|
|
9
10
|
var _newTarget = this.constructor;
|
|
@@ -16,7 +17,7 @@ var DisplayNames = /** @class */ (function () {
|
|
|
16
17
|
var localeData = DisplayNames.localeData;
|
|
17
18
|
var matcher = ecma402_abstract_1.GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
|
|
18
19
|
opt.localeMatcher = matcher;
|
|
19
|
-
var r =
|
|
20
|
+
var r = intl_localematcher_1.ResolveLocale(DisplayNames.availableLocales, requestedLocales, opt, [], // there is no relevantExtensionKeys
|
|
20
21
|
DisplayNames.localeData, DisplayNames.getDefaultLocale);
|
|
21
22
|
var style = ecma402_abstract_1.GetOption(options, 'style', 'string', ['narrow', 'short', 'long'], 'long');
|
|
22
23
|
setSlot(this, 'style', style);
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-displaynames/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-displaynames/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,sBAAsB,EACtB,gBAAgB,EAIjB,MAAM,4BAA4B,CAAA;AAInC,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IACrC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;IACnC,IAAI,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAA;IACnD,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAA;IAChD,IAAI,EAAE,WAAW,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAA;IAC9C,QAAQ,EAAE,WAAW,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAA;CACvD;AAED,qBAAa,YAAY;gBAErB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EACtC,OAAO,EAAE,mBAAmB;IAmF9B,MAAM,CAAC,kBAAkB,CACvB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,eAAe,CAAC,GACnD,MAAM,EAAE;IAQX,MAAM,CAAC,eAAe,CAAC,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI;IAgB/D,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS;IA4DvE,eAAe,IAAI,2BAA2B;IAc9C,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,CAAK;IACpE,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAoB;IACnD,OAAO,CAAC,MAAM,CAAC,eAAe,CAAK;IACnC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAG/B,gBAAuB,UAAU,QAAO;CACzC"}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
|
-
import { getInternalSlot, setInternalSlot, GetOption,
|
|
2
|
+
import { getInternalSlot, setInternalSlot, GetOption, invariant, SupportedLocales, IsWellFormedCurrencyCode, getMultiInternalSlots, ToString, CanonicalizeLocaleList, GetOptionsObject, } from '@formatjs/ecma402-abstract';
|
|
3
3
|
import { CanonicalCodeForDisplayNames } from './abstract/CanonicalCodeForDisplayNames';
|
|
4
|
+
import { ResolveLocale } from '@formatjs/intl-localematcher';
|
|
4
5
|
var DisplayNames = /** @class */ (function () {
|
|
5
6
|
function DisplayNames(locales, options) {
|
|
6
7
|
var _newTarget = this.constructor;
|
package/lib/should-polyfill.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function shouldPolyfill(): boolean;
|
|
1
|
+
export declare function shouldPolyfill(locale?: string | string[]): boolean;
|
|
2
2
|
//# sourceMappingURL=should-polyfill.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-displaynames/should-polyfill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-displaynames/should-polyfill.ts"],"names":[],"mappings":"AAyCA,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,WAOxD"}
|
package/lib/should-polyfill.js
CHANGED
|
@@ -22,6 +22,17 @@ function hasScriptBug() {
|
|
|
22
22
|
}
|
|
23
23
|
return false;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
function supportedLocalesOf(locale) {
|
|
26
|
+
if (!locale) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
var locales = Array.isArray(locale) ? locale : [locale];
|
|
30
|
+
return (Intl.DisplayNames.supportedLocalesOf(locales).length ===
|
|
31
|
+
locales.length);
|
|
32
|
+
}
|
|
33
|
+
export function shouldPolyfill(locale) {
|
|
34
|
+
return (!Intl.DisplayNames ||
|
|
35
|
+
hasMissingICUBug() ||
|
|
36
|
+
hasScriptBug() ||
|
|
37
|
+
!supportedLocalesOf(locale));
|
|
27
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-displaynames",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Polyfill for: https://tc39.es/proposal-intl-displaynames",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"url": "git+https://github.com/formatjs/formatjs.git"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@formatjs/ecma402-abstract": "1.9.
|
|
24
|
+
"@formatjs/ecma402-abstract": "1.9.5",
|
|
25
|
+
"@formatjs/intl-localematcher": "0.2.18",
|
|
25
26
|
"tslib": "^2.1.0"
|
|
26
27
|
},
|
|
27
28
|
"bugs": {
|
package/polyfill.iife.js
CHANGED
|
@@ -1,4 +1,338 @@
|
|
|
1
1
|
(function() {
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __markAsModule = function(target) {
|
|
9
|
+
return __defProp(target, "__esModule", {value: true});
|
|
10
|
+
};
|
|
11
|
+
var __commonJS = function(cb, mod) {
|
|
12
|
+
return function __require() {
|
|
13
|
+
return mod || (0, cb[Object.keys(cb)[0]])((mod = {exports: {}}).exports, mod), mod.exports;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
var __reExport = function(target, module, desc) {
|
|
17
|
+
if (module && typeof module === "object" || typeof module === "function")
|
|
18
|
+
for (var keys = __getOwnPropNames(module), i = 0, n = keys.length, key; i < n; i++) {
|
|
19
|
+
key = keys[i];
|
|
20
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
21
|
+
__defProp(target, key, {get: function(k) {
|
|
22
|
+
return module[k];
|
|
23
|
+
}.bind(null, key), enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable});
|
|
24
|
+
}
|
|
25
|
+
return target;
|
|
26
|
+
};
|
|
27
|
+
var __toModule = function(module) {
|
|
28
|
+
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? {get: function() {
|
|
29
|
+
return module.default;
|
|
30
|
+
}, enumerable: true} : {value: module, enumerable: true})), module);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/utils.js
|
|
34
|
+
var require_utils = __commonJS({
|
|
35
|
+
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/utils.js": function(exports) {
|
|
36
|
+
"use strict";
|
|
37
|
+
Object.defineProperty(exports, "__esModule", {value: true});
|
|
38
|
+
exports.invariant = exports.UNICODE_EXTENSION_SEQUENCE_REGEX = void 0;
|
|
39
|
+
exports.UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
|
|
40
|
+
function invariant2(condition, message, Err) {
|
|
41
|
+
if (Err === void 0) {
|
|
42
|
+
Err = Error;
|
|
43
|
+
}
|
|
44
|
+
if (!condition) {
|
|
45
|
+
throw new Err(message);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.invariant = invariant2;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestAvailableLocale.js
|
|
53
|
+
var require_BestAvailableLocale = __commonJS({
|
|
54
|
+
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestAvailableLocale.js": function(exports) {
|
|
55
|
+
"use strict";
|
|
56
|
+
Object.defineProperty(exports, "__esModule", {value: true});
|
|
57
|
+
exports.BestAvailableLocale = void 0;
|
|
58
|
+
function BestAvailableLocale(availableLocales, locale) {
|
|
59
|
+
var candidate = locale;
|
|
60
|
+
while (true) {
|
|
61
|
+
if (availableLocales.has(candidate)) {
|
|
62
|
+
return candidate;
|
|
63
|
+
}
|
|
64
|
+
var pos = candidate.lastIndexOf("-");
|
|
65
|
+
if (!~pos) {
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
68
|
+
if (pos >= 2 && candidate[pos - 2] === "-") {
|
|
69
|
+
pos -= 2;
|
|
70
|
+
}
|
|
71
|
+
candidate = candidate.slice(0, pos);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.BestAvailableLocale = BestAvailableLocale;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupMatcher.js
|
|
79
|
+
var require_LookupMatcher = __commonJS({
|
|
80
|
+
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupMatcher.js": function(exports) {
|
|
81
|
+
"use strict";
|
|
82
|
+
Object.defineProperty(exports, "__esModule", {value: true});
|
|
83
|
+
exports.LookupMatcher = void 0;
|
|
84
|
+
var utils_1 = require_utils();
|
|
85
|
+
var BestAvailableLocale_1 = require_BestAvailableLocale();
|
|
86
|
+
function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
87
|
+
var result = {locale: ""};
|
|
88
|
+
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
89
|
+
var locale = requestedLocales_1[_i];
|
|
90
|
+
var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
91
|
+
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
92
|
+
if (availableLocale) {
|
|
93
|
+
result.locale = availableLocale;
|
|
94
|
+
if (locale !== noExtensionLocale) {
|
|
95
|
+
result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
result.locale = getDefaultLocale();
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
exports.LookupMatcher = LookupMatcher;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestFitMatcher.js
|
|
108
|
+
var require_BestFitMatcher = __commonJS({
|
|
109
|
+
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestFitMatcher.js": function(exports) {
|
|
110
|
+
"use strict";
|
|
111
|
+
Object.defineProperty(exports, "__esModule", {value: true});
|
|
112
|
+
exports.BestFitMatcher = void 0;
|
|
113
|
+
var BestAvailableLocale_1 = require_BestAvailableLocale();
|
|
114
|
+
var utils_1 = require_utils();
|
|
115
|
+
function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
116
|
+
var minimizedAvailableLocaleMap = Array.from(availableLocales).reduce(function(all, l2) {
|
|
117
|
+
all[l2] = l2;
|
|
118
|
+
return all;
|
|
119
|
+
}, {});
|
|
120
|
+
var minimizedAvailableLocales = new Set();
|
|
121
|
+
availableLocales.forEach(function(locale2) {
|
|
122
|
+
var minimizedLocale = new Intl.Locale(locale2).minimize().toString();
|
|
123
|
+
minimizedAvailableLocaleMap[minimizedLocale] = locale2;
|
|
124
|
+
minimizedAvailableLocales.add(minimizedLocale);
|
|
125
|
+
});
|
|
126
|
+
var foundLocale;
|
|
127
|
+
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
128
|
+
var l = requestedLocales_1[_i];
|
|
129
|
+
if (foundLocale) {
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
var noExtensionLocale = l.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
133
|
+
if (availableLocales.has(noExtensionLocale)) {
|
|
134
|
+
foundLocale = noExtensionLocale;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
if (minimizedAvailableLocales.has(noExtensionLocale)) {
|
|
138
|
+
foundLocale = noExtensionLocale;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
var locale = new Intl.Locale(noExtensionLocale);
|
|
142
|
+
var maximizedRequestedLocale = locale.maximize().toString();
|
|
143
|
+
var minimizedRequestedLocale = locale.minimize().toString();
|
|
144
|
+
if (minimizedAvailableLocales.has(minimizedRequestedLocale)) {
|
|
145
|
+
foundLocale = minimizedRequestedLocale;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
foundLocale = BestAvailableLocale_1.BestAvailableLocale(minimizedAvailableLocales, maximizedRequestedLocale);
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
locale: foundLocale && minimizedAvailableLocaleMap[foundLocale] || getDefaultLocale()
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
exports.BestFitMatcher = BestFitMatcher;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/UnicodeExtensionValue.js
|
|
159
|
+
var require_UnicodeExtensionValue = __commonJS({
|
|
160
|
+
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/UnicodeExtensionValue.js": function(exports) {
|
|
161
|
+
"use strict";
|
|
162
|
+
Object.defineProperty(exports, "__esModule", {value: true});
|
|
163
|
+
exports.UnicodeExtensionValue = void 0;
|
|
164
|
+
var utils_1 = require_utils();
|
|
165
|
+
function UnicodeExtensionValue(extension, key) {
|
|
166
|
+
utils_1.invariant(key.length === 2, "key must have 2 elements");
|
|
167
|
+
var size = extension.length;
|
|
168
|
+
var searchValue = "-" + key + "-";
|
|
169
|
+
var pos = extension.indexOf(searchValue);
|
|
170
|
+
if (pos !== -1) {
|
|
171
|
+
var start = pos + 4;
|
|
172
|
+
var end = start;
|
|
173
|
+
var k = start;
|
|
174
|
+
var done = false;
|
|
175
|
+
while (!done) {
|
|
176
|
+
var e = extension.indexOf("-", k);
|
|
177
|
+
var len = void 0;
|
|
178
|
+
if (e === -1) {
|
|
179
|
+
len = size - k;
|
|
180
|
+
} else {
|
|
181
|
+
len = e - k;
|
|
182
|
+
}
|
|
183
|
+
if (len === 2) {
|
|
184
|
+
done = true;
|
|
185
|
+
} else if (e === -1) {
|
|
186
|
+
end = size;
|
|
187
|
+
done = true;
|
|
188
|
+
} else {
|
|
189
|
+
end = e;
|
|
190
|
+
k = e + 1;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return extension.slice(start, end);
|
|
194
|
+
}
|
|
195
|
+
searchValue = "-" + key;
|
|
196
|
+
pos = extension.indexOf(searchValue);
|
|
197
|
+
if (pos !== -1 && pos + 3 === size) {
|
|
198
|
+
return "";
|
|
199
|
+
}
|
|
200
|
+
return void 0;
|
|
201
|
+
}
|
|
202
|
+
exports.UnicodeExtensionValue = UnicodeExtensionValue;
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/ResolveLocale.js
|
|
207
|
+
var require_ResolveLocale = __commonJS({
|
|
208
|
+
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/ResolveLocale.js": function(exports) {
|
|
209
|
+
"use strict";
|
|
210
|
+
Object.defineProperty(exports, "__esModule", {value: true});
|
|
211
|
+
exports.ResolveLocale = void 0;
|
|
212
|
+
var LookupMatcher_1 = require_LookupMatcher();
|
|
213
|
+
var BestFitMatcher_1 = require_BestFitMatcher();
|
|
214
|
+
var utils_1 = require_utils();
|
|
215
|
+
var UnicodeExtensionValue_1 = require_UnicodeExtensionValue();
|
|
216
|
+
function ResolveLocale3(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData, getDefaultLocale) {
|
|
217
|
+
var matcher = options.localeMatcher;
|
|
218
|
+
var r;
|
|
219
|
+
if (matcher === "lookup") {
|
|
220
|
+
r = LookupMatcher_1.LookupMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
221
|
+
} else {
|
|
222
|
+
r = BestFitMatcher_1.BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
223
|
+
}
|
|
224
|
+
var foundLocale = r.locale;
|
|
225
|
+
var result = {locale: "", dataLocale: foundLocale};
|
|
226
|
+
var supportedExtension = "-u";
|
|
227
|
+
for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {
|
|
228
|
+
var key = relevantExtensionKeys_1[_i];
|
|
229
|
+
utils_1.invariant(foundLocale in localeData, "Missing locale data for " + foundLocale);
|
|
230
|
+
var foundLocaleData = localeData[foundLocale];
|
|
231
|
+
utils_1.invariant(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data " + key + " must be an object");
|
|
232
|
+
var keyLocaleData = foundLocaleData[key];
|
|
233
|
+
utils_1.invariant(Array.isArray(keyLocaleData), "keyLocaleData for " + key + " must be an array");
|
|
234
|
+
var value = keyLocaleData[0];
|
|
235
|
+
utils_1.invariant(typeof value === "string" || value === null, "value must be string or null but got " + typeof value + " in key " + key);
|
|
236
|
+
var supportedExtensionAddition = "";
|
|
237
|
+
if (r.extension) {
|
|
238
|
+
var requestedValue = UnicodeExtensionValue_1.UnicodeExtensionValue(r.extension, key);
|
|
239
|
+
if (requestedValue !== void 0) {
|
|
240
|
+
if (requestedValue !== "") {
|
|
241
|
+
if (~keyLocaleData.indexOf(requestedValue)) {
|
|
242
|
+
value = requestedValue;
|
|
243
|
+
supportedExtensionAddition = "-" + key + "-" + value;
|
|
244
|
+
}
|
|
245
|
+
} else if (~requestedValue.indexOf("true")) {
|
|
246
|
+
value = "true";
|
|
247
|
+
supportedExtensionAddition = "-" + key;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (key in options) {
|
|
252
|
+
var optionsValue = options[key];
|
|
253
|
+
utils_1.invariant(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
|
|
254
|
+
if (~keyLocaleData.indexOf(optionsValue)) {
|
|
255
|
+
if (optionsValue !== value) {
|
|
256
|
+
value = optionsValue;
|
|
257
|
+
supportedExtensionAddition = "";
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
result[key] = value;
|
|
262
|
+
supportedExtension += supportedExtensionAddition;
|
|
263
|
+
}
|
|
264
|
+
if (supportedExtension.length > 2) {
|
|
265
|
+
var privateIndex = foundLocale.indexOf("-x-");
|
|
266
|
+
if (privateIndex === -1) {
|
|
267
|
+
foundLocale = foundLocale + supportedExtension;
|
|
268
|
+
} else {
|
|
269
|
+
var preExtension = foundLocale.slice(0, privateIndex);
|
|
270
|
+
var postExtension = foundLocale.slice(privateIndex, foundLocale.length);
|
|
271
|
+
foundLocale = preExtension + supportedExtension + postExtension;
|
|
272
|
+
}
|
|
273
|
+
foundLocale = Intl.getCanonicalLocales(foundLocale)[0];
|
|
274
|
+
}
|
|
275
|
+
result.locale = foundLocale;
|
|
276
|
+
return result;
|
|
277
|
+
}
|
|
278
|
+
exports.ResolveLocale = ResolveLocale3;
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupSupportedLocales.js
|
|
283
|
+
var require_LookupSupportedLocales = __commonJS({
|
|
284
|
+
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupSupportedLocales.js": function(exports) {
|
|
285
|
+
"use strict";
|
|
286
|
+
Object.defineProperty(exports, "__esModule", {value: true});
|
|
287
|
+
exports.LookupSupportedLocales = void 0;
|
|
288
|
+
var utils_1 = require_utils();
|
|
289
|
+
var BestAvailableLocale_1 = require_BestAvailableLocale();
|
|
290
|
+
function LookupSupportedLocales2(availableLocales, requestedLocales) {
|
|
291
|
+
var subset = [];
|
|
292
|
+
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
293
|
+
var locale = requestedLocales_1[_i];
|
|
294
|
+
var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
295
|
+
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
296
|
+
if (availableLocale) {
|
|
297
|
+
subset.push(availableLocale);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return subset;
|
|
301
|
+
}
|
|
302
|
+
exports.LookupSupportedLocales = LookupSupportedLocales2;
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/index.js
|
|
307
|
+
var require_intl_localematcher = __commonJS({
|
|
308
|
+
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/index.js": function(exports) {
|
|
309
|
+
"use strict";
|
|
310
|
+
Object.defineProperty(exports, "__esModule", {value: true});
|
|
311
|
+
exports.ResolveLocale = exports.LookupSupportedLocales = exports.match = void 0;
|
|
312
|
+
var ResolveLocale_1 = require_ResolveLocale();
|
|
313
|
+
function match(requestedLocales, availableLocales, defaultLocale, opts) {
|
|
314
|
+
var locales = availableLocales.reduce(function(all, l) {
|
|
315
|
+
all.add(l);
|
|
316
|
+
return all;
|
|
317
|
+
}, new Set());
|
|
318
|
+
return ResolveLocale_1.ResolveLocale(locales, requestedLocales, {
|
|
319
|
+
localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
|
|
320
|
+
}, [], {}, function() {
|
|
321
|
+
return defaultLocale;
|
|
322
|
+
}).locale;
|
|
323
|
+
}
|
|
324
|
+
exports.match = match;
|
|
325
|
+
var LookupSupportedLocales_1 = require_LookupSupportedLocales();
|
|
326
|
+
Object.defineProperty(exports, "LookupSupportedLocales", {enumerable: true, get: function() {
|
|
327
|
+
return LookupSupportedLocales_1.LookupSupportedLocales;
|
|
328
|
+
}});
|
|
329
|
+
var ResolveLocale_2 = require_ResolveLocale();
|
|
330
|
+
Object.defineProperty(exports, "ResolveLocale", {enumerable: true, get: function() {
|
|
331
|
+
return ResolveLocale_2.ResolveLocale;
|
|
332
|
+
}});
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
|
|
2
336
|
// node_modules/tslib/tslib.es6.js
|
|
3
337
|
var extendStatics = function(d, b) {
|
|
4
338
|
extendStatics = Object.setPrototypeOf || {__proto__: []} instanceof Array && function(d2, b2) {
|
|
@@ -187,7 +521,6 @@
|
|
|
187
521
|
return all;
|
|
188
522
|
}, Object.create(null));
|
|
189
523
|
}
|
|
190
|
-
var UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
|
|
191
524
|
function invariant(condition, message, Err) {
|
|
192
525
|
if (Err === void 0) {
|
|
193
526
|
Err = Error;
|
|
@@ -204,199 +537,11 @@
|
|
|
204
537
|
var CARET_S_UNICODE_REGEX = new RegExp("^" + S_UNICODE_REGEX.source);
|
|
205
538
|
var S_DOLLAR_UNICODE_REGEX = new RegExp(S_UNICODE_REGEX.source + "$");
|
|
206
539
|
|
|
207
|
-
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/
|
|
208
|
-
|
|
209
|
-
var candidate = locale;
|
|
210
|
-
while (true) {
|
|
211
|
-
if (availableLocales.has(candidate)) {
|
|
212
|
-
return candidate;
|
|
213
|
-
}
|
|
214
|
-
var pos = candidate.lastIndexOf("-");
|
|
215
|
-
if (!~pos) {
|
|
216
|
-
return void 0;
|
|
217
|
-
}
|
|
218
|
-
if (pos >= 2 && candidate[pos - 2] === "-") {
|
|
219
|
-
pos -= 2;
|
|
220
|
-
}
|
|
221
|
-
candidate = candidate.slice(0, pos);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/LookupMatcher.js
|
|
226
|
-
function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
227
|
-
var result = {locale: ""};
|
|
228
|
-
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
229
|
-
var locale = requestedLocales_1[_i];
|
|
230
|
-
var noExtensionLocale = locale.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
231
|
-
var availableLocale = BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
232
|
-
if (availableLocale) {
|
|
233
|
-
result.locale = availableLocale;
|
|
234
|
-
if (locale !== noExtensionLocale) {
|
|
235
|
-
result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);
|
|
236
|
-
}
|
|
237
|
-
return result;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
result.locale = getDefaultLocale();
|
|
241
|
-
return result;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/BestFitMatcher.js
|
|
245
|
-
function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
246
|
-
var minimizedAvailableLocaleMap = {};
|
|
247
|
-
var minimizedAvailableLocales = new Set();
|
|
248
|
-
availableLocales.forEach(function(locale2) {
|
|
249
|
-
var minimizedLocale = new Intl.Locale(locale2).minimize().toString();
|
|
250
|
-
minimizedAvailableLocaleMap[minimizedLocale] = locale2;
|
|
251
|
-
minimizedAvailableLocales.add(minimizedLocale);
|
|
252
|
-
});
|
|
253
|
-
var foundLocale;
|
|
254
|
-
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
255
|
-
var l = requestedLocales_1[_i];
|
|
256
|
-
if (foundLocale) {
|
|
257
|
-
break;
|
|
258
|
-
}
|
|
259
|
-
var noExtensionLocale = l.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
260
|
-
if (availableLocales.has(noExtensionLocale)) {
|
|
261
|
-
foundLocale = noExtensionLocale;
|
|
262
|
-
break;
|
|
263
|
-
}
|
|
264
|
-
if (minimizedAvailableLocales.has(noExtensionLocale)) {
|
|
265
|
-
foundLocale = minimizedAvailableLocaleMap[noExtensionLocale];
|
|
266
|
-
break;
|
|
267
|
-
}
|
|
268
|
-
var locale = new Intl.Locale(noExtensionLocale);
|
|
269
|
-
var maximizedRequestedLocale = locale.maximize().toString();
|
|
270
|
-
var minimizedRequestedLocale = locale.minimize().toString();
|
|
271
|
-
if (minimizedAvailableLocales.has(minimizedRequestedLocale)) {
|
|
272
|
-
foundLocale = minimizedAvailableLocaleMap[minimizedRequestedLocale];
|
|
273
|
-
break;
|
|
274
|
-
}
|
|
275
|
-
foundLocale = BestAvailableLocale(minimizedAvailableLocales, maximizedRequestedLocale);
|
|
276
|
-
}
|
|
277
|
-
return {
|
|
278
|
-
locale: foundLocale || getDefaultLocale()
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/UnicodeExtensionValue.js
|
|
283
|
-
function UnicodeExtensionValue(extension, key) {
|
|
284
|
-
invariant(key.length === 2, "key must have 2 elements");
|
|
285
|
-
var size = extension.length;
|
|
286
|
-
var searchValue = "-" + key + "-";
|
|
287
|
-
var pos = extension.indexOf(searchValue);
|
|
288
|
-
if (pos !== -1) {
|
|
289
|
-
var start = pos + 4;
|
|
290
|
-
var end = start;
|
|
291
|
-
var k = start;
|
|
292
|
-
var done = false;
|
|
293
|
-
while (!done) {
|
|
294
|
-
var e = extension.indexOf("-", k);
|
|
295
|
-
var len = void 0;
|
|
296
|
-
if (e === -1) {
|
|
297
|
-
len = size - k;
|
|
298
|
-
} else {
|
|
299
|
-
len = e - k;
|
|
300
|
-
}
|
|
301
|
-
if (len === 2) {
|
|
302
|
-
done = true;
|
|
303
|
-
} else if (e === -1) {
|
|
304
|
-
end = size;
|
|
305
|
-
done = true;
|
|
306
|
-
} else {
|
|
307
|
-
end = e;
|
|
308
|
-
k = e + 1;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
return extension.slice(start, end);
|
|
312
|
-
}
|
|
313
|
-
searchValue = "-" + key;
|
|
314
|
-
pos = extension.indexOf(searchValue);
|
|
315
|
-
if (pos !== -1 && pos + 3 === size) {
|
|
316
|
-
return "";
|
|
317
|
-
}
|
|
318
|
-
return void 0;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/ResolveLocale.js
|
|
322
|
-
function ResolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData, getDefaultLocale) {
|
|
323
|
-
var matcher = options.localeMatcher;
|
|
324
|
-
var r;
|
|
325
|
-
if (matcher === "lookup") {
|
|
326
|
-
r = LookupMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
327
|
-
} else {
|
|
328
|
-
r = BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
329
|
-
}
|
|
330
|
-
var foundLocale = r.locale;
|
|
331
|
-
var result = {locale: "", dataLocale: foundLocale};
|
|
332
|
-
var supportedExtension = "-u";
|
|
333
|
-
for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {
|
|
334
|
-
var key = relevantExtensionKeys_1[_i];
|
|
335
|
-
invariant(foundLocale in localeData, "Missing locale data for " + foundLocale);
|
|
336
|
-
var foundLocaleData = localeData[foundLocale];
|
|
337
|
-
invariant(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data " + key + " must be an object");
|
|
338
|
-
var keyLocaleData = foundLocaleData[key];
|
|
339
|
-
invariant(Array.isArray(keyLocaleData), "keyLocaleData for " + key + " must be an array");
|
|
340
|
-
var value = keyLocaleData[0];
|
|
341
|
-
invariant(typeof value === "string" || value === null, "value must be string or null but got " + typeof value + " in key " + key);
|
|
342
|
-
var supportedExtensionAddition = "";
|
|
343
|
-
if (r.extension) {
|
|
344
|
-
var requestedValue = UnicodeExtensionValue(r.extension, key);
|
|
345
|
-
if (requestedValue !== void 0) {
|
|
346
|
-
if (requestedValue !== "") {
|
|
347
|
-
if (~keyLocaleData.indexOf(requestedValue)) {
|
|
348
|
-
value = requestedValue;
|
|
349
|
-
supportedExtensionAddition = "-" + key + "-" + value;
|
|
350
|
-
}
|
|
351
|
-
} else if (~requestedValue.indexOf("true")) {
|
|
352
|
-
value = "true";
|
|
353
|
-
supportedExtensionAddition = "-" + key;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
if (key in options) {
|
|
358
|
-
var optionsValue = options[key];
|
|
359
|
-
invariant(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
|
|
360
|
-
if (~keyLocaleData.indexOf(optionsValue)) {
|
|
361
|
-
if (optionsValue !== value) {
|
|
362
|
-
value = optionsValue;
|
|
363
|
-
supportedExtensionAddition = "";
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
result[key] = value;
|
|
368
|
-
supportedExtension += supportedExtensionAddition;
|
|
369
|
-
}
|
|
370
|
-
if (supportedExtension.length > 2) {
|
|
371
|
-
var privateIndex = foundLocale.indexOf("-x-");
|
|
372
|
-
if (privateIndex === -1) {
|
|
373
|
-
foundLocale = foundLocale + supportedExtension;
|
|
374
|
-
} else {
|
|
375
|
-
var preExtension = foundLocale.slice(0, privateIndex);
|
|
376
|
-
var postExtension = foundLocale.slice(privateIndex, foundLocale.length);
|
|
377
|
-
foundLocale = preExtension + supportedExtension + postExtension;
|
|
378
|
-
}
|
|
379
|
-
foundLocale = Intl.getCanonicalLocales(foundLocale)[0];
|
|
380
|
-
}
|
|
381
|
-
result.locale = foundLocale;
|
|
382
|
-
return result;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/LookupSupportedLocales.js
|
|
386
|
-
function LookupSupportedLocales(availableLocales, requestedLocales) {
|
|
387
|
-
var subset = [];
|
|
388
|
-
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
389
|
-
var locale = requestedLocales_1[_i];
|
|
390
|
-
var noExtensionLocale = locale.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
391
|
-
var availableLocale = BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
392
|
-
if (availableLocale) {
|
|
393
|
-
subset.push(availableLocale);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
return subset;
|
|
397
|
-
}
|
|
540
|
+
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/NumberFormat/InitializeNumberFormat.js
|
|
541
|
+
var import_intl_localematcher = __toModule(require_intl_localematcher());
|
|
398
542
|
|
|
399
543
|
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/SupportedLocales.js
|
|
544
|
+
var import_intl_localematcher2 = __toModule(require_intl_localematcher());
|
|
400
545
|
function SupportedLocales(availableLocales, requestedLocales, options) {
|
|
401
546
|
var matcher = "best fit";
|
|
402
547
|
if (options !== void 0) {
|
|
@@ -404,9 +549,9 @@
|
|
|
404
549
|
matcher = GetOption(options, "localeMatcher", "string", ["lookup", "best fit"], "best fit");
|
|
405
550
|
}
|
|
406
551
|
if (matcher === "best fit") {
|
|
407
|
-
return LookupSupportedLocales(availableLocales, requestedLocales);
|
|
552
|
+
return (0, import_intl_localematcher2.LookupSupportedLocales)(availableLocales, requestedLocales);
|
|
408
553
|
}
|
|
409
|
-
return LookupSupportedLocales(availableLocales, requestedLocales);
|
|
554
|
+
return (0, import_intl_localematcher2.LookupSupportedLocales)(availableLocales, requestedLocales);
|
|
410
555
|
}
|
|
411
556
|
|
|
412
557
|
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/data.js
|
|
@@ -461,6 +606,7 @@
|
|
|
461
606
|
}
|
|
462
607
|
|
|
463
608
|
// bazel-out/darwin-fastbuild/bin/packages/intl-displaynames/lib/index.js
|
|
609
|
+
var import_intl_localematcher3 = __toModule(require_intl_localematcher());
|
|
464
610
|
var DisplayNames = function() {
|
|
465
611
|
function DisplayNames2(locales, options) {
|
|
466
612
|
var _newTarget = this.constructor;
|
|
@@ -473,7 +619,7 @@
|
|
|
473
619
|
var localeData = DisplayNames2.localeData;
|
|
474
620
|
var matcher = GetOption(options, "localeMatcher", "string", ["lookup", "best fit"], "best fit");
|
|
475
621
|
opt.localeMatcher = matcher;
|
|
476
|
-
var r = ResolveLocale(DisplayNames2.availableLocales, requestedLocales, opt, [], DisplayNames2.localeData, DisplayNames2.getDefaultLocale);
|
|
622
|
+
var r = (0, import_intl_localematcher3.ResolveLocale)(DisplayNames2.availableLocales, requestedLocales, opt, [], DisplayNames2.localeData, DisplayNames2.getDefaultLocale);
|
|
477
623
|
var style = GetOption(options, "style", "string", ["narrow", "short", "long"], "long");
|
|
478
624
|
setSlot(this, "style", style);
|
|
479
625
|
var type = GetOption(options, "type", "string", ["language", "currency", "region", "script"], void 0);
|
|
@@ -625,8 +771,15 @@
|
|
|
625
771
|
}
|
|
626
772
|
return false;
|
|
627
773
|
}
|
|
628
|
-
function
|
|
629
|
-
|
|
774
|
+
function supportedLocalesOf(locale) {
|
|
775
|
+
if (!locale) {
|
|
776
|
+
return true;
|
|
777
|
+
}
|
|
778
|
+
var locales = Array.isArray(locale) ? locale : [locale];
|
|
779
|
+
return Intl.DisplayNames.supportedLocalesOf(locales).length === locales.length;
|
|
780
|
+
}
|
|
781
|
+
function shouldPolyfill(locale) {
|
|
782
|
+
return !Intl.DisplayNames || hasMissingICUBug() || hasScriptBug() || !supportedLocalesOf(locale);
|
|
630
783
|
}
|
|
631
784
|
|
|
632
785
|
// bazel-out/darwin-fastbuild/bin/packages/intl-displaynames/lib/polyfill.js
|
package/should-polyfill.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function shouldPolyfill(): boolean;
|
|
1
|
+
export declare function shouldPolyfill(locale?: string | string[]): boolean;
|
|
2
2
|
//# sourceMappingURL=should-polyfill.d.ts.map
|
package/should-polyfill.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-displaynames/should-polyfill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-displaynames/should-polyfill.ts"],"names":[],"mappings":"AAyCA,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,WAOxD"}
|
package/should-polyfill.js
CHANGED
|
@@ -25,7 +25,18 @@ function hasScriptBug() {
|
|
|
25
25
|
}
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
28
|
+
function supportedLocalesOf(locale) {
|
|
29
|
+
if (!locale) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
var locales = Array.isArray(locale) ? locale : [locale];
|
|
33
|
+
return (Intl.DisplayNames.supportedLocalesOf(locales).length ===
|
|
34
|
+
locales.length);
|
|
35
|
+
}
|
|
36
|
+
function shouldPolyfill(locale) {
|
|
37
|
+
return (!Intl.DisplayNames ||
|
|
38
|
+
hasMissingICUBug() ||
|
|
39
|
+
hasScriptBug() ||
|
|
40
|
+
!supportedLocalesOf(locale));
|
|
30
41
|
}
|
|
31
42
|
exports.shouldPolyfill = shouldPolyfill;
|