@formatjs/intl-pluralrules
Version:
Polyfill for Intl.PluralRules
25 lines (24 loc) • 1.03 kB
JavaScript
/* @generated */
// prettier-ignore
if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["few","one","other"],"ordinal":["one","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 === 1)
return "one";
}
else {
if (v !== 0 || n === 0 || n !== 1 && ((n % 100) >= 1 && (n % 100) <= 19))
return "few";
if (i === 1 && v === 0)
return "one";
}
return "other";
},"pluralRanges":{"cardinal":{"few_few":"few","few_one":"few","few_other":"other","one_few":"few","one_other":"other","other_few":"few","other_other":"other"},"ordinal":{}}},"locale":"ro"})
}