intl-messageformat 9.6.6 → 9.6.7
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/intl-messageformat.iife.js +46 -47
- package/package.json +2 -2
|
@@ -8,20 +8,16 @@ var IntlMessageFormat = (function() {
|
|
|
8
8
|
var __markAsModule = function(target) {
|
|
9
9
|
return __defProp(target, "__esModule", {value: true});
|
|
10
10
|
};
|
|
11
|
-
var __commonJS = function(
|
|
11
|
+
var __commonJS = function(cb, mod) {
|
|
12
12
|
return function() {
|
|
13
|
-
|
|
14
|
-
module = {exports: {}};
|
|
15
|
-
callback(module.exports, module);
|
|
16
|
-
}
|
|
17
|
-
return module.exports;
|
|
13
|
+
return mod || cb((mod = {exports: {}}).exports, mod), mod.exports;
|
|
18
14
|
};
|
|
19
15
|
};
|
|
20
16
|
var __export = function(target, all) {
|
|
21
17
|
for (var name in all)
|
|
22
18
|
__defProp(target, name, {get: all[name], enumerable: true});
|
|
23
19
|
};
|
|
24
|
-
var
|
|
20
|
+
var __reExport = function(target, module, desc) {
|
|
25
21
|
if (module && typeof module === "object" || typeof module === "function")
|
|
26
22
|
for (var keys = __getOwnPropNames(module), i = 0, n = keys.length, key; i < n; i++) {
|
|
27
23
|
key = keys[i];
|
|
@@ -33,9 +29,9 @@ var IntlMessageFormat = (function() {
|
|
|
33
29
|
return target;
|
|
34
30
|
};
|
|
35
31
|
var __toModule = function(module) {
|
|
36
|
-
|
|
37
|
-
return module;
|
|
38
|
-
|
|
32
|
+
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? {get: function() {
|
|
33
|
+
return module.default;
|
|
34
|
+
}, enumerable: true} : {value: module, enumerable: true})), module);
|
|
39
35
|
};
|
|
40
36
|
|
|
41
37
|
// external/npm/node_modules/tslib/tslib.js
|
|
@@ -62,7 +58,7 @@ var IntlMessageFormat = (function() {
|
|
|
62
58
|
var __metadata;
|
|
63
59
|
var __awaiter;
|
|
64
60
|
var __generator;
|
|
65
|
-
var
|
|
61
|
+
var __exportStar;
|
|
66
62
|
var __values;
|
|
67
63
|
var __read;
|
|
68
64
|
var __spread;
|
|
@@ -261,7 +257,7 @@ var IntlMessageFormat = (function() {
|
|
|
261
257
|
return {value: op[0] ? op[1] : void 0, done: true};
|
|
262
258
|
}
|
|
263
259
|
};
|
|
264
|
-
|
|
260
|
+
__exportStar = function(m, o) {
|
|
265
261
|
for (var p in m)
|
|
266
262
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
267
263
|
__createBinding(o, m, p);
|
|
@@ -430,18 +426,21 @@ var IntlMessageFormat = (function() {
|
|
|
430
426
|
__importDefault = function(mod) {
|
|
431
427
|
return mod && mod.__esModule ? mod : {default: mod};
|
|
432
428
|
};
|
|
433
|
-
__classPrivateFieldGet = function(receiver,
|
|
434
|
-
if (!
|
|
435
|
-
throw new TypeError("
|
|
436
|
-
|
|
437
|
-
|
|
429
|
+
__classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
430
|
+
if (kind === "a" && !f)
|
|
431
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
432
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
433
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
434
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
438
435
|
};
|
|
439
|
-
__classPrivateFieldSet = function(receiver,
|
|
440
|
-
if (
|
|
441
|
-
throw new TypeError("
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
436
|
+
__classPrivateFieldSet = function(receiver, state, value, kind, f) {
|
|
437
|
+
if (kind === "m")
|
|
438
|
+
throw new TypeError("Private method is not writable");
|
|
439
|
+
if (kind === "a" && !f)
|
|
440
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
441
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
442
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
443
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
445
444
|
};
|
|
446
445
|
exporter("__extends", __extends2);
|
|
447
446
|
exporter("__assign", __assign2);
|
|
@@ -451,7 +450,7 @@ var IntlMessageFormat = (function() {
|
|
|
451
450
|
exporter("__metadata", __metadata);
|
|
452
451
|
exporter("__awaiter", __awaiter);
|
|
453
452
|
exporter("__generator", __generator);
|
|
454
|
-
exporter("__exportStar",
|
|
453
|
+
exporter("__exportStar", __exportStar);
|
|
455
454
|
exporter("__createBinding", __createBinding);
|
|
456
455
|
exporter("__values", __values);
|
|
457
456
|
exporter("__read", __read);
|
|
@@ -1932,7 +1931,7 @@ var IntlMessageFormat = (function() {
|
|
|
1932
1931
|
ErrorCode2["MISSING_INTL_API"] = "MISSING_INTL_API";
|
|
1933
1932
|
})(ErrorCode || (ErrorCode = {}));
|
|
1934
1933
|
var FormatError = function(_super) {
|
|
1935
|
-
import_tslib.__extends(FormatError2, _super);
|
|
1934
|
+
(0, import_tslib.__extends)(FormatError2, _super);
|
|
1936
1935
|
function FormatError2(msg, code, originalMessage) {
|
|
1937
1936
|
var _this = _super.call(this, msg) || this;
|
|
1938
1937
|
_this.code = code;
|
|
@@ -1945,21 +1944,21 @@ var IntlMessageFormat = (function() {
|
|
|
1945
1944
|
return FormatError2;
|
|
1946
1945
|
}(Error);
|
|
1947
1946
|
var InvalidValueError = function(_super) {
|
|
1948
|
-
import_tslib.__extends(InvalidValueError2, _super);
|
|
1947
|
+
(0, import_tslib.__extends)(InvalidValueError2, _super);
|
|
1949
1948
|
function InvalidValueError2(variableId, value, options, originalMessage) {
|
|
1950
1949
|
return _super.call(this, 'Invalid values for "' + variableId + '": "' + value + '". Options are "' + Object.keys(options).join('", "') + '"', ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
1951
1950
|
}
|
|
1952
1951
|
return InvalidValueError2;
|
|
1953
1952
|
}(FormatError);
|
|
1954
1953
|
var InvalidValueTypeError = function(_super) {
|
|
1955
|
-
import_tslib.__extends(InvalidValueTypeError2, _super);
|
|
1954
|
+
(0, import_tslib.__extends)(InvalidValueTypeError2, _super);
|
|
1956
1955
|
function InvalidValueTypeError2(value, type, originalMessage) {
|
|
1957
1956
|
return _super.call(this, 'Value for "' + value + '" must be of type ' + type, ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
1958
1957
|
}
|
|
1959
1958
|
return InvalidValueTypeError2;
|
|
1960
1959
|
}(FormatError);
|
|
1961
1960
|
var MissingValueError = function(_super) {
|
|
1962
|
-
import_tslib.__extends(MissingValueError2, _super);
|
|
1961
|
+
(0, import_tslib.__extends)(MissingValueError2, _super);
|
|
1963
1962
|
function MissingValueError2(variableId, originalMessage) {
|
|
1964
1963
|
return _super.call(this, 'The intl string context variable "' + variableId + '" was not provided to the string "' + originalMessage + '"', ErrorCode.MISSING_VALUE, originalMessage) || this;
|
|
1965
1964
|
}
|
|
@@ -1990,7 +1989,7 @@ var IntlMessageFormat = (function() {
|
|
|
1990
1989
|
return typeof el === "function";
|
|
1991
1990
|
}
|
|
1992
1991
|
function formatToParts(els, locales, formatters, formats, values, currentPluralValue, originalMessage) {
|
|
1993
|
-
if (els.length === 1 && import_icu_messageformat_parser.isLiteralElement(els[0])) {
|
|
1992
|
+
if (els.length === 1 && (0, import_icu_messageformat_parser.isLiteralElement)(els[0])) {
|
|
1994
1993
|
return [
|
|
1995
1994
|
{
|
|
1996
1995
|
type: PART_TYPE.literal,
|
|
@@ -2001,14 +2000,14 @@ var IntlMessageFormat = (function() {
|
|
|
2001
2000
|
var result = [];
|
|
2002
2001
|
for (var _i = 0, els_1 = els; _i < els_1.length; _i++) {
|
|
2003
2002
|
var el = els_1[_i];
|
|
2004
|
-
if (import_icu_messageformat_parser.isLiteralElement(el)) {
|
|
2003
|
+
if ((0, import_icu_messageformat_parser.isLiteralElement)(el)) {
|
|
2005
2004
|
result.push({
|
|
2006
2005
|
type: PART_TYPE.literal,
|
|
2007
2006
|
value: el.value
|
|
2008
2007
|
});
|
|
2009
2008
|
continue;
|
|
2010
2009
|
}
|
|
2011
|
-
if (import_icu_messageformat_parser.isPoundElement(el)) {
|
|
2010
|
+
if ((0, import_icu_messageformat_parser.isPoundElement)(el)) {
|
|
2012
2011
|
if (typeof currentPluralValue === "number") {
|
|
2013
2012
|
result.push({
|
|
2014
2013
|
type: PART_TYPE.literal,
|
|
@@ -2022,7 +2021,7 @@ var IntlMessageFormat = (function() {
|
|
|
2022
2021
|
throw new MissingValueError(varName, originalMessage);
|
|
2023
2022
|
}
|
|
2024
2023
|
var value = values[varName];
|
|
2025
|
-
if (import_icu_messageformat_parser.isArgumentElement(el)) {
|
|
2024
|
+
if ((0, import_icu_messageformat_parser.isArgumentElement)(el)) {
|
|
2026
2025
|
if (!value || typeof value === "string" || typeof value === "number") {
|
|
2027
2026
|
value = typeof value === "string" || typeof value === "number" ? String(value) : "";
|
|
2028
2027
|
}
|
|
@@ -2032,24 +2031,24 @@ var IntlMessageFormat = (function() {
|
|
|
2032
2031
|
});
|
|
2033
2032
|
continue;
|
|
2034
2033
|
}
|
|
2035
|
-
if (import_icu_messageformat_parser.isDateElement(el)) {
|
|
2036
|
-
var style = typeof el.style === "string" ? formats.date[el.style] : import_icu_messageformat_parser.isDateTimeSkeleton(el.style) ? el.style.parsedOptions : void 0;
|
|
2034
|
+
if ((0, import_icu_messageformat_parser.isDateElement)(el)) {
|
|
2035
|
+
var style = typeof el.style === "string" ? formats.date[el.style] : (0, import_icu_messageformat_parser.isDateTimeSkeleton)(el.style) ? el.style.parsedOptions : void 0;
|
|
2037
2036
|
result.push({
|
|
2038
2037
|
type: PART_TYPE.literal,
|
|
2039
2038
|
value: formatters.getDateTimeFormat(locales, style).format(value)
|
|
2040
2039
|
});
|
|
2041
2040
|
continue;
|
|
2042
2041
|
}
|
|
2043
|
-
if (import_icu_messageformat_parser.isTimeElement(el)) {
|
|
2044
|
-
var style = typeof el.style === "string" ? formats.time[el.style] : import_icu_messageformat_parser.isDateTimeSkeleton(el.style) ? el.style.parsedOptions : void 0;
|
|
2042
|
+
if ((0, import_icu_messageformat_parser.isTimeElement)(el)) {
|
|
2043
|
+
var style = typeof el.style === "string" ? formats.time[el.style] : (0, import_icu_messageformat_parser.isDateTimeSkeleton)(el.style) ? el.style.parsedOptions : void 0;
|
|
2045
2044
|
result.push({
|
|
2046
2045
|
type: PART_TYPE.literal,
|
|
2047
2046
|
value: formatters.getDateTimeFormat(locales, style).format(value)
|
|
2048
2047
|
});
|
|
2049
2048
|
continue;
|
|
2050
2049
|
}
|
|
2051
|
-
if (import_icu_messageformat_parser.isNumberElement(el)) {
|
|
2052
|
-
var style = typeof el.style === "string" ? formats.number[el.style] : import_icu_messageformat_parser.isNumberSkeleton(el.style) ? el.style.parsedOptions : void 0;
|
|
2050
|
+
if ((0, import_icu_messageformat_parser.isNumberElement)(el)) {
|
|
2051
|
+
var style = typeof el.style === "string" ? formats.number[el.style] : (0, import_icu_messageformat_parser.isNumberSkeleton)(el.style) ? el.style.parsedOptions : void 0;
|
|
2053
2052
|
if (style && style.scale) {
|
|
2054
2053
|
value = value * (style.scale || 1);
|
|
2055
2054
|
}
|
|
@@ -2059,7 +2058,7 @@ var IntlMessageFormat = (function() {
|
|
|
2059
2058
|
});
|
|
2060
2059
|
continue;
|
|
2061
2060
|
}
|
|
2062
|
-
if (import_icu_messageformat_parser.isTagElement(el)) {
|
|
2061
|
+
if ((0, import_icu_messageformat_parser.isTagElement)(el)) {
|
|
2063
2062
|
var children = el.children, value_1 = el.value;
|
|
2064
2063
|
var formatFn = values[value_1];
|
|
2065
2064
|
if (!isFormatXMLElementFn(formatFn)) {
|
|
@@ -2079,7 +2078,7 @@ var IntlMessageFormat = (function() {
|
|
|
2079
2078
|
};
|
|
2080
2079
|
}));
|
|
2081
2080
|
}
|
|
2082
|
-
if (import_icu_messageformat_parser.isSelectElement(el)) {
|
|
2081
|
+
if ((0, import_icu_messageformat_parser.isSelectElement)(el)) {
|
|
2083
2082
|
var opt = el.options[value] || el.options.other;
|
|
2084
2083
|
if (!opt) {
|
|
2085
2084
|
throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
|
|
@@ -2087,7 +2086,7 @@ var IntlMessageFormat = (function() {
|
|
|
2087
2086
|
result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values));
|
|
2088
2087
|
continue;
|
|
2089
2088
|
}
|
|
2090
|
-
if (import_icu_messageformat_parser.isPluralElement(el)) {
|
|
2089
|
+
if ((0, import_icu_messageformat_parser.isPluralElement)(el)) {
|
|
2091
2090
|
var opt = el.options["=" + value];
|
|
2092
2091
|
if (!opt) {
|
|
2093
2092
|
if (!Intl.PluralRules) {
|
|
@@ -2111,8 +2110,8 @@ var IntlMessageFormat = (function() {
|
|
|
2111
2110
|
if (!c2) {
|
|
2112
2111
|
return c1;
|
|
2113
2112
|
}
|
|
2114
|
-
return import_tslib2.__assign(import_tslib2.__assign(import_tslib2.__assign({}, c1 || {}), c2 || {}), Object.keys(c1).reduce(function(all, k) {
|
|
2115
|
-
all[k] = import_tslib2.__assign(import_tslib2.__assign({}, c1[k]), c2[k] || {});
|
|
2113
|
+
return (0, import_tslib2.__assign)((0, import_tslib2.__assign)((0, import_tslib2.__assign)({}, c1 || {}), c2 || {}), Object.keys(c1).reduce(function(all, k) {
|
|
2114
|
+
all[k] = (0, import_tslib2.__assign)((0, import_tslib2.__assign)({}, c1[k]), c2[k] || {});
|
|
2116
2115
|
return all;
|
|
2117
2116
|
}, {}));
|
|
2118
2117
|
}
|
|
@@ -2123,7 +2122,7 @@ var IntlMessageFormat = (function() {
|
|
|
2123
2122
|
return Object.keys(defaultConfig).reduce(function(all, k) {
|
|
2124
2123
|
all[k] = mergeConfig(defaultConfig[k], configs[k]);
|
|
2125
2124
|
return all;
|
|
2126
|
-
}, import_tslib2.__assign({}, defaultConfig));
|
|
2125
|
+
}, (0, import_tslib2.__assign)({}, defaultConfig));
|
|
2127
2126
|
}
|
|
2128
2127
|
function createFastMemoizeCache(store) {
|
|
2129
2128
|
return {
|
|
@@ -2159,7 +2158,7 @@ var IntlMessageFormat = (function() {
|
|
|
2159
2158
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2160
2159
|
args[_i] = arguments[_i];
|
|
2161
2160
|
}
|
|
2162
|
-
return new ((_a = Intl.NumberFormat).bind.apply(_a, import_tslib2.__spreadArray([void 0], args)))();
|
|
2161
|
+
return new ((_a = Intl.NumberFormat).bind.apply(_a, (0, import_tslib2.__spreadArray)([void 0], args)))();
|
|
2163
2162
|
}, {
|
|
2164
2163
|
cache: createFastMemoizeCache(cache.number),
|
|
2165
2164
|
strategy: memoizeIntl.strategies.variadic
|
|
@@ -2170,7 +2169,7 @@ var IntlMessageFormat = (function() {
|
|
|
2170
2169
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2171
2170
|
args[_i] = arguments[_i];
|
|
2172
2171
|
}
|
|
2173
|
-
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, import_tslib2.__spreadArray([void 0], args)))();
|
|
2172
|
+
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, (0, import_tslib2.__spreadArray)([void 0], args)))();
|
|
2174
2173
|
}, {
|
|
2175
2174
|
cache: createFastMemoizeCache(cache.dateTime),
|
|
2176
2175
|
strategy: memoizeIntl.strategies.variadic
|
|
@@ -2181,7 +2180,7 @@ var IntlMessageFormat = (function() {
|
|
|
2181
2180
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2182
2181
|
args[_i] = arguments[_i];
|
|
2183
2182
|
}
|
|
2184
|
-
return new ((_a = Intl.PluralRules).bind.apply(_a, import_tslib2.__spreadArray([void 0], args)))();
|
|
2183
|
+
return new ((_a = Intl.PluralRules).bind.apply(_a, (0, import_tslib2.__spreadArray)([void 0], args)))();
|
|
2185
2184
|
}, {
|
|
2186
2185
|
cache: createFastMemoizeCache(cache.pluralRules),
|
|
2187
2186
|
strategy: memoizeIntl.strategies.variadic
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intl-messageformat",
|
|
3
|
-
"version": "9.6.
|
|
3
|
+
"version": "9.6.7",
|
|
4
4
|
"description": "Formats ICU Message strings with number, date, plural, and select placeholders to create localized messages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"module": "lib/index.js",
|
|
32
32
|
"types": "index.d.ts",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@formatjs/icu-messageformat-parser": "1.1.
|
|
34
|
+
"@formatjs/icu-messageformat-parser": "1.1.5",
|
|
35
35
|
"fast-memoize": "^2.5.2",
|
|
36
36
|
"tslib": "^2.1.0"
|
|
37
37
|
},
|