@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":["few","many","one","other","two"],"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));
if (isOrdinal) {
if (n === 1)
return "one";
}
else {
if ((n >= 3 && n <= 6))
return "few";
if ((n >= 7 && n <= 10))
return "many";
if (n === 1)
return "one";
if (n === 2)
return "two";
}
return "other";
},"pluralRanges":{"cardinal":{"few_few":"few","few_many":"many","few_other":"other","many_many":"many","many_other":"other","one_few":"few","one_many":"many","one_other":"other","one_two":"two","other_few":"few","other_many":"many","other_one":"one","other_other":"other","other_two":"two","two_few":"few","two_many":"many","two_other":"other"},"ordinal":{}}},"locale":"ga"})
}