@formatjs/intl-pluralrules
Version:
Polyfill for Intl.PluralRules
37 lines (36 loc) • 1.55 kB
JavaScript
/* @generated */
// prettier-ignore
if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["few","many","one","other","two","zero"],"ordinal":["few","many","one","other","two","zero"]},"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 === 3 || n === 4))
return "few";
if ((n === 5 || n === 6))
return "many";
if (n === 1)
return "one";
if (n === 2)
return "two";
if ((((n === 0 || n === 7) || n === 8) || n === 9))
return "zero";
}
else {
if (n === 3)
return "few";
if (n === 6)
return "many";
if (n === 1)
return "one";
if (n === 2)
return "two";
if (n === 0)
return "zero";
}
return "other";
},"pluralRanges":{"cardinal":{"few_many":"many","few_other":"other","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","zero_few":"few","zero_many":"many","zero_one":"one","zero_other":"other","zero_two":"two"},"ordinal":{}}},"locale":"cy"})
}