@formatjs/intl-pluralrules
Version:
Polyfill for Intl.PluralRules
27 lines (26 loc) • 1.18 kB
JavaScript
/* @generated */
// prettier-ignore
if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["one","other"],"ordinal":["many","one","other","two"]},"fn":function(num, isOrdinal, exponent = 0) {
const numStr = String(num);
const parts = numStr.split(".");
const integerPart = parts[0];
const decimalPart = parts[1] || "";
const i = Math.floor(Math.abs(parseFloat(integerPart)));
const v = decimalPart.length;
const f = v > 0 ? parseInt(decimalPart, 10) : 0;
if (isOrdinal) {
if (((i % 10) === 7 || (i % 10) === 8) && ((i % 100) !== 17 && (i % 100) !== 18))
return "many";
if ((i % 10) === 1 && (i % 100) !== 11)
return "one";
if ((i % 10) === 2 && (i % 100) !== 12)
return "two";
}
else {
if (v === 0 && (i % 10) === 1 && (i % 100) !== 11 || (f % 10) === 1 && (f % 100) !== 11)
return "one";
}
return "other";
},"pluralRanges":{"cardinal":{"one_one":"other","one_other":"other","other_one":"other","other_other":"other"},"ordinal":{}}},"locale":"mk"})
}