@formatjs/intl-pluralrules 5.2.6 → 5.2.8
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.js +2 -1
- package/lib/abstract/GetOperands.js +12 -8
- package/lib/abstract/InitializePluralRules.js +13 -9
- package/lib/abstract/ResolvePlural.js +12 -8
- package/lib/get_internal_slots.js +4 -1
- package/lib/index.js +17 -13
- package/lib/polyfill-force.js +4 -2
- package/lib/polyfill.js +6 -4
- package/lib/should-polyfill.js +8 -4
- package/lib/supported-locales.generated.js +4 -1
- package/locale-data/ca.js +5 -3
- package/locale-data/he.js +3 -4
- package/locale-data/is.js +2 -2
- package/locale-data/mo.js +1 -1
- package/locale-data/mt.js +3 -2
- package/locale-data/ro.js +1 -1
- package/package.json +6 -6
- package/polyfill.iife.js +7885 -854
- package/abstract/GetOperands.d.ts.map +0 -1
- package/abstract/InitializePluralRules.d.ts.map +0 -1
- package/abstract/ResolvePlural.d.ts.map +0 -1
- package/get_internal_slots.d.ts.map +0 -1
- package/index.d.ts.map +0 -1
- package/lib/abstract/GetOperands.d.ts.map +0 -1
- package/lib/abstract/InitializePluralRules.d.ts.map +0 -1
- package/lib/abstract/ResolvePlural.d.ts.map +0 -1
- package/lib/get_internal_slots.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/polyfill-force.d.ts.map +0 -1
- package/lib/polyfill.d.ts.map +0 -1
- package/lib/should-polyfill.d.ts.map +0 -1
- package/lib/supported-locales.generated.d.ts.map +0 -1
- package/polyfill-force.d.ts.map +0 -1
- package/polyfill.d.ts.map +0 -1
- package/should-polyfill.d.ts.map +0 -1
- package/supported-locales.generated.d.ts.map +0 -1
package/index.js
CHANGED
|
@@ -24,7 +24,7 @@ function PluralRuleSelect(locale, type, _n, _a) {
|
|
|
24
24
|
? "".concat(IntegerDigits, ".").concat(FractionDigits)
|
|
25
25
|
: IntegerDigits, type === 'ordinal');
|
|
26
26
|
}
|
|
27
|
-
var PluralRules =
|
|
27
|
+
var PluralRules = /** @class */ (function () {
|
|
28
28
|
function PluralRules(locales, options) {
|
|
29
29
|
// test262/test/intl402/RelativeTimeFormat/constructor/constructor/newtarget-undefined.js
|
|
30
30
|
// Cannot use `new.target` bc of IE11 & TS transpiles it to something else
|
|
@@ -97,6 +97,7 @@ var PluralRules = exports.PluralRules = /** @class */ (function () {
|
|
|
97
97
|
PluralRules.polyfilled = true;
|
|
98
98
|
return PluralRules;
|
|
99
99
|
}());
|
|
100
|
+
exports.PluralRules = PluralRules;
|
|
100
101
|
try {
|
|
101
102
|
// IE11 does not have Symbol
|
|
102
103
|
if (typeof Symbol !== 'undefined') {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetOperands = void 0;
|
|
4
|
+
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
2
5
|
/**
|
|
3
6
|
* http://ecma-international.org/ecma-402/7.0/index.html#sec-getoperands
|
|
4
7
|
* @param s
|
|
5
8
|
*/
|
|
6
|
-
|
|
7
|
-
invariant(typeof s === 'string', "GetOperands should have been called with a string");
|
|
8
|
-
var n = ToNumber(s);
|
|
9
|
-
invariant(isFinite(n), 'n should be finite');
|
|
9
|
+
function GetOperands(s) {
|
|
10
|
+
(0, ecma402_abstract_1.invariant)(typeof s === 'string', "GetOperands should have been called with a string");
|
|
11
|
+
var n = (0, ecma402_abstract_1.ToNumber)(s);
|
|
12
|
+
(0, ecma402_abstract_1.invariant)(isFinite(n), 'n should be finite');
|
|
10
13
|
var dp = s.indexOf('.');
|
|
11
14
|
var iv;
|
|
12
15
|
var f;
|
|
@@ -20,16 +23,16 @@ export function GetOperands(s) {
|
|
|
20
23
|
else {
|
|
21
24
|
iv = s.slice(0, dp);
|
|
22
25
|
fv = s.slice(dp, s.length);
|
|
23
|
-
f = ToNumber(fv);
|
|
26
|
+
f = (0, ecma402_abstract_1.ToNumber)(fv);
|
|
24
27
|
v = fv.length;
|
|
25
28
|
}
|
|
26
|
-
var i = Math.abs(ToNumber(iv));
|
|
29
|
+
var i = Math.abs((0, ecma402_abstract_1.ToNumber)(iv));
|
|
27
30
|
var w;
|
|
28
31
|
var t;
|
|
29
32
|
if (f !== 0) {
|
|
30
33
|
var ft = fv.replace(/0+$/, '');
|
|
31
34
|
w = ft.length;
|
|
32
|
-
t = ToNumber(ft);
|
|
35
|
+
t = (0, ecma402_abstract_1.ToNumber)(ft);
|
|
33
36
|
}
|
|
34
37
|
else {
|
|
35
38
|
w = 0;
|
|
@@ -44,3 +47,4 @@ export function GetOperands(s) {
|
|
|
44
47
|
FractionDigitsWithoutTrailing: t,
|
|
45
48
|
};
|
|
46
49
|
}
|
|
50
|
+
exports.GetOperands = GetOperands;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InitializePluralRules = void 0;
|
|
4
|
+
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
5
|
+
var intl_localematcher_1 = require("@formatjs/intl-localematcher");
|
|
6
|
+
function InitializePluralRules(pl, locales, options, _a) {
|
|
4
7
|
var availableLocales = _a.availableLocales, relevantExtensionKeys = _a.relevantExtensionKeys, localeData = _a.localeData, getDefaultLocale = _a.getDefaultLocale, getInternalSlots = _a.getInternalSlots;
|
|
5
|
-
var requestedLocales = CanonicalizeLocaleList(locales);
|
|
8
|
+
var requestedLocales = (0, ecma402_abstract_1.CanonicalizeLocaleList)(locales);
|
|
6
9
|
var opt = Object.create(null);
|
|
7
|
-
var opts = CoerceOptionsToObject(options);
|
|
10
|
+
var opts = (0, ecma402_abstract_1.CoerceOptionsToObject)(options);
|
|
8
11
|
var internalSlots = getInternalSlots(pl);
|
|
9
12
|
internalSlots.initializedPluralRules = true;
|
|
10
|
-
var matcher = GetOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit');
|
|
13
|
+
var matcher = (0, ecma402_abstract_1.GetOption)(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit');
|
|
11
14
|
opt.localeMatcher = matcher;
|
|
12
|
-
internalSlots.type = GetOption(opts, 'type', 'string', ['cardinal', 'ordinal'], 'cardinal');
|
|
13
|
-
SetNumberFormatDigitOptions(internalSlots, opts, 0, 3, 'standard');
|
|
14
|
-
var r = ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
|
|
15
|
+
internalSlots.type = (0, ecma402_abstract_1.GetOption)(opts, 'type', 'string', ['cardinal', 'ordinal'], 'cardinal');
|
|
16
|
+
(0, ecma402_abstract_1.SetNumberFormatDigitOptions)(internalSlots, opts, 0, 3, 'standard');
|
|
17
|
+
var r = (0, intl_localematcher_1.ResolveLocale)(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
|
|
15
18
|
internalSlots.locale = r.locale;
|
|
16
19
|
return pl;
|
|
17
20
|
}
|
|
21
|
+
exports.InitializePluralRules = InitializePluralRules;
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResolvePlural = void 0;
|
|
4
|
+
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
5
|
+
var GetOperands_1 = require("./GetOperands");
|
|
3
6
|
/**
|
|
4
7
|
* http://ecma-international.org/ecma-402/7.0/index.html#sec-resolveplural
|
|
5
8
|
* @param pl
|
|
6
9
|
* @param n
|
|
7
10
|
* @param PluralRuleSelect Has to pass in bc it's implementation-specific
|
|
8
11
|
*/
|
|
9
|
-
|
|
12
|
+
function ResolvePlural(pl, n, _a) {
|
|
10
13
|
var getInternalSlots = _a.getInternalSlots, PluralRuleSelect = _a.PluralRuleSelect;
|
|
11
14
|
var internalSlots = getInternalSlots(pl);
|
|
12
|
-
invariant(Type(internalSlots) === 'Object', 'pl has to be an object');
|
|
13
|
-
invariant('initializedPluralRules' in internalSlots, 'pluralrules must be initialized');
|
|
14
|
-
invariant(Type(n) === 'Number', 'n must be a number');
|
|
15
|
+
(0, ecma402_abstract_1.invariant)((0, ecma402_abstract_1.Type)(internalSlots) === 'Object', 'pl has to be an object');
|
|
16
|
+
(0, ecma402_abstract_1.invariant)('initializedPluralRules' in internalSlots, 'pluralrules must be initialized');
|
|
17
|
+
(0, ecma402_abstract_1.invariant)((0, ecma402_abstract_1.Type)(n) === 'Number', 'n must be a number');
|
|
15
18
|
if (!isFinite(n)) {
|
|
16
19
|
return 'other';
|
|
17
20
|
}
|
|
18
21
|
var locale = internalSlots.locale, type = internalSlots.type;
|
|
19
|
-
var res = FormatNumericToString(internalSlots, n);
|
|
22
|
+
var res = (0, ecma402_abstract_1.FormatNumericToString)(internalSlots, n);
|
|
20
23
|
var s = res.formattedString;
|
|
21
|
-
var operands = GetOperands(s);
|
|
24
|
+
var operands = (0, GetOperands_1.GetOperands)(s);
|
|
22
25
|
return PluralRuleSelect(locale, type, n, operands);
|
|
23
26
|
}
|
|
27
|
+
exports.ResolvePlural = ResolvePlural;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
var internalSlotMap = new WeakMap();
|
|
2
|
-
|
|
4
|
+
function getInternalSlots(x) {
|
|
3
5
|
var internalSlots = internalSlotMap.get(x);
|
|
4
6
|
if (!internalSlots) {
|
|
5
7
|
internalSlots = Object.create(null);
|
|
@@ -7,3 +9,4 @@ export default function getInternalSlots(x) {
|
|
|
7
9
|
}
|
|
8
10
|
return internalSlots;
|
|
9
11
|
}
|
|
12
|
+
exports.default = getInternalSlots;
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PluralRules = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
6
|
+
var InitializePluralRules_1 = require("./abstract/InitializePluralRules");
|
|
7
|
+
var ResolvePlural_1 = require("./abstract/ResolvePlural");
|
|
8
|
+
var get_internal_slots_1 = tslib_1.__importDefault(require("./get_internal_slots"));
|
|
6
9
|
function validateInstance(instance, method) {
|
|
7
10
|
if (!(instance instanceof PluralRules)) {
|
|
8
11
|
throw new TypeError("Method Intl.PluralRules.prototype.".concat(method, " called on incompatible receiver ").concat(String(instance)));
|
|
@@ -21,7 +24,7 @@ function PluralRuleSelect(locale, type, _n, _a) {
|
|
|
21
24
|
? "".concat(IntegerDigits, ".").concat(FractionDigits)
|
|
22
25
|
: IntegerDigits, type === 'ordinal');
|
|
23
26
|
}
|
|
24
|
-
|
|
27
|
+
var PluralRules = /** @class */ (function () {
|
|
25
28
|
function PluralRules(locales, options) {
|
|
26
29
|
// test262/test/intl402/RelativeTimeFormat/constructor/constructor/newtarget-undefined.js
|
|
27
30
|
// Cannot use `new.target` bc of IE11 & TS transpiles it to something else
|
|
@@ -29,18 +32,18 @@ export var PluralRules = /** @class */ (function () {
|
|
|
29
32
|
if (!newTarget) {
|
|
30
33
|
throw new TypeError("Intl.PluralRules must be called with 'new'");
|
|
31
34
|
}
|
|
32
|
-
return InitializePluralRules(this, locales, options, {
|
|
35
|
+
return (0, InitializePluralRules_1.InitializePluralRules)(this, locales, options, {
|
|
33
36
|
availableLocales: PluralRules.availableLocales,
|
|
34
37
|
relevantExtensionKeys: PluralRules.relevantExtensionKeys,
|
|
35
38
|
localeData: PluralRules.localeData,
|
|
36
39
|
getDefaultLocale: PluralRules.getDefaultLocale,
|
|
37
|
-
getInternalSlots:
|
|
40
|
+
getInternalSlots: get_internal_slots_1.default,
|
|
38
41
|
});
|
|
39
42
|
}
|
|
40
43
|
PluralRules.prototype.resolvedOptions = function () {
|
|
41
44
|
validateInstance(this, 'resolvedOptions');
|
|
42
45
|
var opts = Object.create(null);
|
|
43
|
-
var internalSlots =
|
|
46
|
+
var internalSlots = (0, get_internal_slots_1.default)(this);
|
|
44
47
|
opts.locale = internalSlots.locale;
|
|
45
48
|
opts.type = internalSlots.type;
|
|
46
49
|
[
|
|
@@ -55,20 +58,20 @@ export var PluralRules = /** @class */ (function () {
|
|
|
55
58
|
opts[field] = val;
|
|
56
59
|
}
|
|
57
60
|
});
|
|
58
|
-
opts.pluralCategories = __spreadArray([], PluralRules.localeData[opts.locale].categories[opts.type], true);
|
|
61
|
+
opts.pluralCategories = tslib_1.__spreadArray([], PluralRules.localeData[opts.locale].categories[opts.type], true);
|
|
59
62
|
return opts;
|
|
60
63
|
};
|
|
61
64
|
PluralRules.prototype.select = function (val) {
|
|
62
65
|
var pr = this;
|
|
63
66
|
validateInstance(pr, 'select');
|
|
64
|
-
var n = ToNumber(val);
|
|
65
|
-
return ResolvePlural(pr, n, { getInternalSlots:
|
|
67
|
+
var n = (0, ecma402_abstract_1.ToNumber)(val);
|
|
68
|
+
return (0, ResolvePlural_1.ResolvePlural)(pr, n, { getInternalSlots: get_internal_slots_1.default, PluralRuleSelect: PluralRuleSelect });
|
|
66
69
|
};
|
|
67
70
|
PluralRules.prototype.toString = function () {
|
|
68
71
|
return '[object Intl.PluralRules]';
|
|
69
72
|
};
|
|
70
73
|
PluralRules.supportedLocalesOf = function (locales, options) {
|
|
71
|
-
return SupportedLocales(PluralRules.availableLocales, CanonicalizeLocaleList(locales), options);
|
|
74
|
+
return (0, ecma402_abstract_1.SupportedLocales)(PluralRules.availableLocales, (0, ecma402_abstract_1.CanonicalizeLocaleList)(locales), options);
|
|
72
75
|
};
|
|
73
76
|
PluralRules.__addLocaleData = function () {
|
|
74
77
|
var data = [];
|
|
@@ -94,6 +97,7 @@ export var PluralRules = /** @class */ (function () {
|
|
|
94
97
|
PluralRules.polyfilled = true;
|
|
95
98
|
return PluralRules;
|
|
96
99
|
}());
|
|
100
|
+
exports.PluralRules = PluralRules;
|
|
97
101
|
try {
|
|
98
102
|
// IE11 does not have Symbol
|
|
99
103
|
if (typeof Symbol !== 'undefined') {
|
package/lib/polyfill-force.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var _1 = require("./");
|
|
2
4
|
Object.defineProperty(Intl, 'PluralRules', {
|
|
3
|
-
value: PluralRules,
|
|
5
|
+
value: _1.PluralRules,
|
|
4
6
|
writable: true,
|
|
5
7
|
enumerable: false,
|
|
6
8
|
configurable: true,
|
package/lib/polyfill.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var _1 = require("./");
|
|
4
|
+
var should_polyfill_1 = require("./should-polyfill");
|
|
5
|
+
if ((0, should_polyfill_1.shouldPolyfill)()) {
|
|
4
6
|
Object.defineProperty(Intl, 'PluralRules', {
|
|
5
|
-
value: PluralRules,
|
|
7
|
+
value: _1.PluralRules,
|
|
6
8
|
writable: true,
|
|
7
9
|
enumerable: false,
|
|
8
10
|
configurable: true,
|
package/lib/should-polyfill.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldPolyfill = void 0;
|
|
4
|
+
var intl_localematcher_1 = require("@formatjs/intl-localematcher");
|
|
5
|
+
var supported_locales_generated_1 = require("./supported-locales.generated");
|
|
3
6
|
function supportedLocalesOf(locale) {
|
|
4
7
|
if (!locale) {
|
|
5
8
|
return true;
|
|
@@ -7,12 +10,13 @@ function supportedLocalesOf(locale) {
|
|
|
7
10
|
var locales = Array.isArray(locale) ? locale : [locale];
|
|
8
11
|
return Intl.PluralRules.supportedLocalesOf(locales).length === locales.length;
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
function shouldPolyfill(locale) {
|
|
11
14
|
if (locale === void 0) { locale = 'en'; }
|
|
12
15
|
if (!('PluralRules' in Intl) ||
|
|
13
16
|
new Intl.PluralRules('en', { minimumFractionDigits: 2 }).select(1) ===
|
|
14
17
|
'one' ||
|
|
15
18
|
!supportedLocalesOf(locale)) {
|
|
16
|
-
return locale ? match([locale], supportedLocales, 'en') : undefined;
|
|
19
|
+
return locale ? (0, intl_localematcher_1.match)([locale], supported_locales_generated_1.supportedLocales, 'en') : undefined;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
22
|
+
exports.shouldPolyfill = shouldPolyfill;
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.supportedLocales = void 0;
|
|
4
|
+
exports.supportedLocales = ["af", "ak", "am", "an", "ar", "ars", "as", "asa", "ast", "az", "bal", "be", "bem", "bez", "bg", "bho", "bm", "bn", "bo", "br", "brx", "bs", "ca", "ce", "ceb", "cgg", "chr", "ckb", "cs", "cy", "da", "de", "doi", "dsb", "dv", "dz", "ee", "el", "en", "eo", "es", "et", "eu", "fa", "ff", "fi", "fil", "fo", "fr", "fur", "fy", "ga", "gd", "gl", "gsw", "gu", "guw", "gv", "ha", "haw", "he", "hi", "hnj", "hr", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "io", "is", "it", "iu", "ja", "jbo", "jgo", "jmc", "jv", "jw", "ka", "kab", "kaj", "kcg", "kde", "kea", "kk", "kkj", "kl", "km", "kn", "ko", "ks", "ksb", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lij", "lkt", "ln", "lo", "lt", "lv", "mas", "mg", "mgo", "mk", "ml", "mn", "mo", "mr", "ms", "mt", "my", "nah", "naq", "nb", "nd", "ne", "nl", "nn", "nnh", "no", "nqo", "nr", "nso", "ny", "nyn", "om", "or", "os", "osa", "pa", "pap", "pcm", "pl", "prg", "ps", "pt", "pt-PT", "rm", "ro", "rof", "ru", "rwk", "sah", "saq", "sat", "sc", "scn", "sd", "sdh", "se", "seh", "ses", "sg", "sh", "shi", "si", "sk", "sl", "sma", "smi", "smj", "smn", "sms", "sn", "so", "sq", "sr", "ss", "ssy", "st", "su", "sv", "sw", "syr", "ta", "te", "teo", "th", "ti", "tig", "tk", "tl", "tn", "to", "tpi", "tr", "ts", "tzm", "ug", "uk", "und", "ur", "uz", "ve", "vi", "vo", "vun", "wa", "wae", "wo", "xh", "xog", "yi", "yo", "yue", "zh", "zu"];
|
package/locale-data/ca.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/* @generated */
|
|
2
2
|
// prettier-ignore
|
|
3
3
|
if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {
|
|
4
|
-
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["one","other"],"ordinal":["one","two","few","other"]},"fn":function(n, ord) {
|
|
5
|
-
var
|
|
4
|
+
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["one","many","other"],"ordinal":["one","two","few","other"]},"fn":function(n, ord) {
|
|
5
|
+
var _n = String(n), se = _n.split(/[ce]/), e = se[1] || 0, c = e, s = String(e ? Number(se[0]) * Math.pow(10, e) : _n).split("."), i = s[0], v0 = !s[1], i1000000 = i.slice(-6);
|
|
6
6
|
if (ord) return (n == 1 || n == 3) ? 'one'
|
|
7
7
|
: n == 2 ? 'two'
|
|
8
8
|
: n == 4 ? 'few'
|
|
9
9
|
: 'other';
|
|
10
|
-
return n == 1 && v0 ? 'one'
|
|
10
|
+
return n == 1 && v0 ? 'one'
|
|
11
|
+
: e == 0 && i != 0 && i1000000 == 0 && v0 || (e < 0 || e > 5) ? 'many'
|
|
12
|
+
: 'other';
|
|
11
13
|
}},"locale":"ca"})
|
|
12
14
|
}
|
package/locale-data/he.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/* @generated */
|
|
2
2
|
// prettier-ignore
|
|
3
3
|
if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {
|
|
4
|
-
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["one","two","
|
|
5
|
-
var s = String(n).split('.'), i = s[0], v0 = !s[1]
|
|
4
|
+
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["one","two","other"],"ordinal":["other"]},"fn":function(n, ord) {
|
|
5
|
+
var s = String(n).split('.'), i = s[0], v0 = !s[1];
|
|
6
6
|
if (ord) return 'other';
|
|
7
|
-
return
|
|
7
|
+
return i == 1 && v0 || i == 0 && !v0 ? 'one'
|
|
8
8
|
: i == 2 && v0 ? 'two'
|
|
9
|
-
: v0 && (n < 0 || n > 10) && t0 && n10 == 0 ? 'many'
|
|
10
9
|
: 'other';
|
|
11
10
|
}},"locale":"he"})
|
|
12
11
|
}
|
package/locale-data/is.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// prettier-ignore
|
|
3
3
|
if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {
|
|
4
4
|
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["one","other"],"ordinal":["other"]},"fn":function(n, ord) {
|
|
5
|
-
var s = String(n).split('.'), i = s[0], t0 = Number(s[0]) == n, i10 = i.slice(-1), i100 = i.slice(-2);
|
|
5
|
+
var s = String(n).split('.'), i = s[0], t = (s[1] || '').replace(/0+$/, ''), t0 = Number(s[0]) == n, i10 = i.slice(-1), i100 = i.slice(-2);
|
|
6
6
|
if (ord) return 'other';
|
|
7
|
-
return t0 && i10 == 1 && i100 != 11 ||
|
|
7
|
+
return t0 && i10 == 1 && i100 != 11 || t % 10 == 1 && t % 100 != 11 ? 'one' : 'other';
|
|
8
8
|
}},"locale":"is"})
|
|
9
9
|
}
|
package/locale-data/mo.js
CHANGED
|
@@ -5,7 +5,7 @@ if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function')
|
|
|
5
5
|
var s = String(n).split('.'), v0 = !s[1], t0 = Number(s[0]) == n, n100 = t0 && s[0].slice(-2);
|
|
6
6
|
if (ord) return n == 1 ? 'one' : 'other';
|
|
7
7
|
return n == 1 && v0 ? 'one'
|
|
8
|
-
: !v0 || n == 0 || (n100 >=
|
|
8
|
+
: !v0 || n == 0 || n != 1 && (n100 >= 1 && n100 <= 19) ? 'few'
|
|
9
9
|
: 'other';
|
|
10
10
|
}},"locale":"mo"})
|
|
11
11
|
}
|
package/locale-data/mt.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/* @generated */
|
|
2
2
|
// prettier-ignore
|
|
3
3
|
if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {
|
|
4
|
-
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["one","few","many","other"],"ordinal":["other"]},"fn":function(n, ord) {
|
|
4
|
+
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["one","two","few","many","other"],"ordinal":["other"]},"fn":function(n, ord) {
|
|
5
5
|
var s = String(n).split('.'), t0 = Number(s[0]) == n, n100 = t0 && s[0].slice(-2);
|
|
6
6
|
if (ord) return 'other';
|
|
7
7
|
return n == 1 ? 'one'
|
|
8
|
-
: n ==
|
|
8
|
+
: n == 2 ? 'two'
|
|
9
|
+
: n == 0 || (n100 >= 3 && n100 <= 10) ? 'few'
|
|
9
10
|
: (n100 >= 11 && n100 <= 19) ? 'many'
|
|
10
11
|
: 'other';
|
|
11
12
|
}},"locale":"mt"})
|
package/locale-data/ro.js
CHANGED
|
@@ -5,7 +5,7 @@ if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function')
|
|
|
5
5
|
var s = String(n).split('.'), v0 = !s[1], t0 = Number(s[0]) == n, n100 = t0 && s[0].slice(-2);
|
|
6
6
|
if (ord) return n == 1 ? 'one' : 'other';
|
|
7
7
|
return n == 1 && v0 ? 'one'
|
|
8
|
-
: !v0 || n == 0 || (n100 >=
|
|
8
|
+
: !v0 || n == 0 || n != 1 && (n100 >= 1 && n100 <= 19) ? 'few'
|
|
9
9
|
: 'other';
|
|
10
10
|
}},"locale":"ro"})
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-pluralrules",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.8",
|
|
4
4
|
"description": "Polyfill for Intl.PluralRules",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"polyfill",
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"url": "git+https://github.com/formatjs/formatjs.git"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"
|
|
24
|
-
"@formatjs/
|
|
25
|
-
"
|
|
23
|
+
"tslib": "^2.4.0",
|
|
24
|
+
"@formatjs/ecma402-abstract": "1.17.3",
|
|
25
|
+
"@formatjs/intl-localematcher": "0.5.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@formatjs/intl-getcanonicallocales": "2.
|
|
29
|
-
"@formatjs/intl-locale": "3.
|
|
28
|
+
"@formatjs/intl-getcanonicallocales": "2.3.0",
|
|
29
|
+
"@formatjs/intl-locale": "3.4.1"
|
|
30
30
|
},
|
|
31
31
|
"bugs": {
|
|
32
32
|
"url": "https://github.com/formatjs/formatjs/issues"
|