intl-messageformat 9.6.3 → 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 +49 -49
- 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);
|
|
@@ -1015,7 +1014,7 @@ var IntlMessageFormat = (function() {
|
|
|
1015
1014
|
};
|
|
1016
1015
|
var REGEX_SUPPORTS_U_AND_Y = true;
|
|
1017
1016
|
try {
|
|
1018
|
-
RE("", "yu");
|
|
1017
|
+
RE("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
|
|
1019
1018
|
} catch (_) {
|
|
1020
1019
|
REGEX_SUPPORTS_U_AND_Y = false;
|
|
1021
1020
|
}
|
|
@@ -1742,7 +1741,7 @@ var IntlMessageFormat = (function() {
|
|
|
1742
1741
|
}();
|
|
1743
1742
|
exports.Parser = Parser;
|
|
1744
1743
|
function _isAlpha(codepoint) {
|
|
1745
|
-
return codepoint >= 97 && codepoint <= 122;
|
|
1744
|
+
return codepoint >= 97 && codepoint <= 122 || codepoint >= 65 && codepoint <= 90;
|
|
1746
1745
|
}
|
|
1747
1746
|
function _isAlphaOrSlash(codepoint) {
|
|
1748
1747
|
return _isAlpha(codepoint) || codepoint === 47;
|
|
@@ -1793,6 +1792,7 @@ var IntlMessageFormat = (function() {
|
|
|
1793
1792
|
if (result.err) {
|
|
1794
1793
|
var error = SyntaxError(error_1.ErrorKind[result.err.kind]);
|
|
1795
1794
|
error.location = result.err.location;
|
|
1795
|
+
error.originalMessage = result.err.message;
|
|
1796
1796
|
throw error;
|
|
1797
1797
|
}
|
|
1798
1798
|
if (!(opts === null || opts === void 0 ? void 0 : opts.captureLocation)) {
|
|
@@ -1931,7 +1931,7 @@ var IntlMessageFormat = (function() {
|
|
|
1931
1931
|
ErrorCode2["MISSING_INTL_API"] = "MISSING_INTL_API";
|
|
1932
1932
|
})(ErrorCode || (ErrorCode = {}));
|
|
1933
1933
|
var FormatError = function(_super) {
|
|
1934
|
-
import_tslib.__extends(FormatError2, _super);
|
|
1934
|
+
(0, import_tslib.__extends)(FormatError2, _super);
|
|
1935
1935
|
function FormatError2(msg, code, originalMessage) {
|
|
1936
1936
|
var _this = _super.call(this, msg) || this;
|
|
1937
1937
|
_this.code = code;
|
|
@@ -1944,21 +1944,21 @@ var IntlMessageFormat = (function() {
|
|
|
1944
1944
|
return FormatError2;
|
|
1945
1945
|
}(Error);
|
|
1946
1946
|
var InvalidValueError = function(_super) {
|
|
1947
|
-
import_tslib.__extends(InvalidValueError2, _super);
|
|
1947
|
+
(0, import_tslib.__extends)(InvalidValueError2, _super);
|
|
1948
1948
|
function InvalidValueError2(variableId, value, options, originalMessage) {
|
|
1949
1949
|
return _super.call(this, 'Invalid values for "' + variableId + '": "' + value + '". Options are "' + Object.keys(options).join('", "') + '"', ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
1950
1950
|
}
|
|
1951
1951
|
return InvalidValueError2;
|
|
1952
1952
|
}(FormatError);
|
|
1953
1953
|
var InvalidValueTypeError = function(_super) {
|
|
1954
|
-
import_tslib.__extends(InvalidValueTypeError2, _super);
|
|
1954
|
+
(0, import_tslib.__extends)(InvalidValueTypeError2, _super);
|
|
1955
1955
|
function InvalidValueTypeError2(value, type, originalMessage) {
|
|
1956
1956
|
return _super.call(this, 'Value for "' + value + '" must be of type ' + type, ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
1957
1957
|
}
|
|
1958
1958
|
return InvalidValueTypeError2;
|
|
1959
1959
|
}(FormatError);
|
|
1960
1960
|
var MissingValueError = function(_super) {
|
|
1961
|
-
import_tslib.__extends(MissingValueError2, _super);
|
|
1961
|
+
(0, import_tslib.__extends)(MissingValueError2, _super);
|
|
1962
1962
|
function MissingValueError2(variableId, originalMessage) {
|
|
1963
1963
|
return _super.call(this, 'The intl string context variable "' + variableId + '" was not provided to the string "' + originalMessage + '"', ErrorCode.MISSING_VALUE, originalMessage) || this;
|
|
1964
1964
|
}
|
|
@@ -1989,7 +1989,7 @@ var IntlMessageFormat = (function() {
|
|
|
1989
1989
|
return typeof el === "function";
|
|
1990
1990
|
}
|
|
1991
1991
|
function formatToParts(els, locales, formatters, formats, values, currentPluralValue, originalMessage) {
|
|
1992
|
-
if (els.length === 1 && import_icu_messageformat_parser.isLiteralElement(els[0])) {
|
|
1992
|
+
if (els.length === 1 && (0, import_icu_messageformat_parser.isLiteralElement)(els[0])) {
|
|
1993
1993
|
return [
|
|
1994
1994
|
{
|
|
1995
1995
|
type: PART_TYPE.literal,
|
|
@@ -2000,14 +2000,14 @@ var IntlMessageFormat = (function() {
|
|
|
2000
2000
|
var result = [];
|
|
2001
2001
|
for (var _i = 0, els_1 = els; _i < els_1.length; _i++) {
|
|
2002
2002
|
var el = els_1[_i];
|
|
2003
|
-
if (import_icu_messageformat_parser.isLiteralElement(el)) {
|
|
2003
|
+
if ((0, import_icu_messageformat_parser.isLiteralElement)(el)) {
|
|
2004
2004
|
result.push({
|
|
2005
2005
|
type: PART_TYPE.literal,
|
|
2006
2006
|
value: el.value
|
|
2007
2007
|
});
|
|
2008
2008
|
continue;
|
|
2009
2009
|
}
|
|
2010
|
-
if (import_icu_messageformat_parser.isPoundElement(el)) {
|
|
2010
|
+
if ((0, import_icu_messageformat_parser.isPoundElement)(el)) {
|
|
2011
2011
|
if (typeof currentPluralValue === "number") {
|
|
2012
2012
|
result.push({
|
|
2013
2013
|
type: PART_TYPE.literal,
|
|
@@ -2021,7 +2021,7 @@ var IntlMessageFormat = (function() {
|
|
|
2021
2021
|
throw new MissingValueError(varName, originalMessage);
|
|
2022
2022
|
}
|
|
2023
2023
|
var value = values[varName];
|
|
2024
|
-
if (import_icu_messageformat_parser.isArgumentElement(el)) {
|
|
2024
|
+
if ((0, import_icu_messageformat_parser.isArgumentElement)(el)) {
|
|
2025
2025
|
if (!value || typeof value === "string" || typeof value === "number") {
|
|
2026
2026
|
value = typeof value === "string" || typeof value === "number" ? String(value) : "";
|
|
2027
2027
|
}
|
|
@@ -2031,24 +2031,24 @@ var IntlMessageFormat = (function() {
|
|
|
2031
2031
|
});
|
|
2032
2032
|
continue;
|
|
2033
2033
|
}
|
|
2034
|
-
if (import_icu_messageformat_parser.isDateElement(el)) {
|
|
2035
|
-
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;
|
|
2036
2036
|
result.push({
|
|
2037
2037
|
type: PART_TYPE.literal,
|
|
2038
2038
|
value: formatters.getDateTimeFormat(locales, style).format(value)
|
|
2039
2039
|
});
|
|
2040
2040
|
continue;
|
|
2041
2041
|
}
|
|
2042
|
-
if (import_icu_messageformat_parser.isTimeElement(el)) {
|
|
2043
|
-
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;
|
|
2044
2044
|
result.push({
|
|
2045
2045
|
type: PART_TYPE.literal,
|
|
2046
2046
|
value: formatters.getDateTimeFormat(locales, style).format(value)
|
|
2047
2047
|
});
|
|
2048
2048
|
continue;
|
|
2049
2049
|
}
|
|
2050
|
-
if (import_icu_messageformat_parser.isNumberElement(el)) {
|
|
2051
|
-
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;
|
|
2052
2052
|
if (style && style.scale) {
|
|
2053
2053
|
value = value * (style.scale || 1);
|
|
2054
2054
|
}
|
|
@@ -2058,7 +2058,7 @@ var IntlMessageFormat = (function() {
|
|
|
2058
2058
|
});
|
|
2059
2059
|
continue;
|
|
2060
2060
|
}
|
|
2061
|
-
if (import_icu_messageformat_parser.isTagElement(el)) {
|
|
2061
|
+
if ((0, import_icu_messageformat_parser.isTagElement)(el)) {
|
|
2062
2062
|
var children = el.children, value_1 = el.value;
|
|
2063
2063
|
var formatFn = values[value_1];
|
|
2064
2064
|
if (!isFormatXMLElementFn(formatFn)) {
|
|
@@ -2078,7 +2078,7 @@ var IntlMessageFormat = (function() {
|
|
|
2078
2078
|
};
|
|
2079
2079
|
}));
|
|
2080
2080
|
}
|
|
2081
|
-
if (import_icu_messageformat_parser.isSelectElement(el)) {
|
|
2081
|
+
if ((0, import_icu_messageformat_parser.isSelectElement)(el)) {
|
|
2082
2082
|
var opt = el.options[value] || el.options.other;
|
|
2083
2083
|
if (!opt) {
|
|
2084
2084
|
throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
|
|
@@ -2086,7 +2086,7 @@ var IntlMessageFormat = (function() {
|
|
|
2086
2086
|
result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values));
|
|
2087
2087
|
continue;
|
|
2088
2088
|
}
|
|
2089
|
-
if (import_icu_messageformat_parser.isPluralElement(el)) {
|
|
2089
|
+
if ((0, import_icu_messageformat_parser.isPluralElement)(el)) {
|
|
2090
2090
|
var opt = el.options["=" + value];
|
|
2091
2091
|
if (!opt) {
|
|
2092
2092
|
if (!Intl.PluralRules) {
|
|
@@ -2110,8 +2110,8 @@ var IntlMessageFormat = (function() {
|
|
|
2110
2110
|
if (!c2) {
|
|
2111
2111
|
return c1;
|
|
2112
2112
|
}
|
|
2113
|
-
return import_tslib2.__assign(import_tslib2.__assign(import_tslib2.__assign({}, c1 || {}), c2 || {}), Object.keys(c1).reduce(function(all, k) {
|
|
2114
|
-
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] || {});
|
|
2115
2115
|
return all;
|
|
2116
2116
|
}, {}));
|
|
2117
2117
|
}
|
|
@@ -2122,7 +2122,7 @@ var IntlMessageFormat = (function() {
|
|
|
2122
2122
|
return Object.keys(defaultConfig).reduce(function(all, k) {
|
|
2123
2123
|
all[k] = mergeConfig(defaultConfig[k], configs[k]);
|
|
2124
2124
|
return all;
|
|
2125
|
-
}, import_tslib2.__assign({}, defaultConfig));
|
|
2125
|
+
}, (0, import_tslib2.__assign)({}, defaultConfig));
|
|
2126
2126
|
}
|
|
2127
2127
|
function createFastMemoizeCache(store) {
|
|
2128
2128
|
return {
|
|
@@ -2158,7 +2158,7 @@ var IntlMessageFormat = (function() {
|
|
|
2158
2158
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2159
2159
|
args[_i] = arguments[_i];
|
|
2160
2160
|
}
|
|
2161
|
-
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)))();
|
|
2162
2162
|
}, {
|
|
2163
2163
|
cache: createFastMemoizeCache(cache.number),
|
|
2164
2164
|
strategy: memoizeIntl.strategies.variadic
|
|
@@ -2169,7 +2169,7 @@ var IntlMessageFormat = (function() {
|
|
|
2169
2169
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2170
2170
|
args[_i] = arguments[_i];
|
|
2171
2171
|
}
|
|
2172
|
-
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)))();
|
|
2173
2173
|
}, {
|
|
2174
2174
|
cache: createFastMemoizeCache(cache.dateTime),
|
|
2175
2175
|
strategy: memoizeIntl.strategies.variadic
|
|
@@ -2180,7 +2180,7 @@ var IntlMessageFormat = (function() {
|
|
|
2180
2180
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2181
2181
|
args[_i] = arguments[_i];
|
|
2182
2182
|
}
|
|
2183
|
-
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)))();
|
|
2184
2184
|
}, {
|
|
2185
2185
|
cache: createFastMemoizeCache(cache.pluralRules),
|
|
2186
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
|
},
|