@formatjs/intl-pluralrules
Version:
Polyfill for Intl.PluralRules
27 lines (26 loc) • 1.44 kB
JavaScript
/* @generated */
// prettier-ignore
if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["few","many","one","other"],"ordinal":["few","other"]},"fn":function(num, isOrdinal, exponent = 0) {
const numStr = String(num);
const parts = numStr.split(".");
const integerPart = parts[0];
const decimalPart = parts[1] || "";
const n = Math.abs(parseFloat(numStr));
const i = Math.floor(Math.abs(parseFloat(integerPart)));
const v = decimalPart.length;
if (isOrdinal) {
if ((n % 10) === 3 && (n % 100) !== 13)
return "few";
}
else {
if (v === 0 && ((i % 10) >= 2 && (i % 10) <= 4) && ((i % 100) < 12 || (i % 100) > 14))
return "few";
if (v === 0 && (i % 10) === 0 || v === 0 && ((i % 10) >= 5 && (i % 10) <= 9) || v === 0 && ((i % 100) >= 11 && (i % 100) <= 14))
return "many";
if (v === 0 && (i % 10) === 1 && (i % 100) !== 11)
return "one";
}
return "other";
},"pluralRanges":{"cardinal":{"few_few":"few","few_many":"many","few_one":"one","few_other":"other","many_few":"few","many_many":"many","many_one":"one","many_other":"other","one_few":"few","one_many":"many","one_one":"one","one_other":"other","other_few":"few","other_many":"many","other_one":"one","other_other":"other"},"ordinal":{}}},"locale":"uk"})
}