@formatjs/intl-pluralrules
Version:
Polyfill for Intl.PluralRules
24 lines (23 loc) • 1.16 kB
JavaScript
/* @generated */
// prettier-ignore
if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["few","one","other","two"],"ordinal":["other"]},"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;
if (isOrdinal) {
}
else {
if (v === 0 && ((i % 100) >= 3 && (i % 100) <= 4) || v !== 0)
return "few";
if (v === 0 && (i % 100) === 1)
return "one";
if (v === 0 && (i % 100) === 2)
return "two";
}
return "other";
},"pluralRanges":{"cardinal":{"few_few":"few","few_one":"few","few_other":"other","few_two":"two","one_few":"few","one_one":"few","one_other":"other","one_two":"two","other_few":"few","other_one":"few","other_other":"other","other_two":"two","two_few":"few","two_one":"few","two_other":"other","two_two":"two"},"ordinal":{}}},"locale":"sl"})
}