@phensley/plurals
Advanced tools
Comparing version 0.21.2 to 0.22.0
@@ -5,67 +5,67 @@ // | ||
export var cardinalRules = { | ||
af: 'B|0\tF|1', | ||
ak: 'B|2\tF|1', | ||
am: 'B|3|0\tF|1', | ||
an: 'B|0\tF|1', | ||
ar: 'A|4\tB|0\tC|5\tD|6\tE|7\tF|1', | ||
ars: 'A|4\tB|0\tC|5\tD|6\tE|7\tF|1', | ||
as: 'B|3|0\tF|1', | ||
asa: 'B|0\tF|1', | ||
ast: 'B|8&9\tF|1', | ||
az: 'B|0\tF|1', | ||
be: 'B|10&11\tD|12&13\tE|14|15|16\tF|1', | ||
bem: 'B|0\tF|1', | ||
bez: 'B|0\tF|1', | ||
bg: 'B|0\tF|1', | ||
bho: 'B|2\tF|1', | ||
af: 'B|0_F|1', | ||
ak: 'B|2_F|1', | ||
am: 'B|3|0_F|1', | ||
an: 'B|0_F|1', | ||
ar: 'A|4_B|0_C|5_D|6_E|7_F|1', | ||
ars: 'A|4_B|0_C|5_D|6_E|7_F|1', | ||
as: 'B|3|0_F|1', | ||
asa: 'B|0_F|1', | ||
ast: 'B|8&9_F|1', | ||
az: 'B|0_F|1', | ||
be: 'B|10&11_D|12&13_E|14|15|16_F|1', | ||
bem: 'B|0_F|1', | ||
bez: 'B|0_F|1', | ||
bg: 'B|0_F|1', | ||
bho: 'B|2_F|1', | ||
bm: 'F|1', | ||
bn: 'B|3|0\tF|1', | ||
bn: 'B|3|0_F|1', | ||
bo: 'F|1', | ||
br: 'B|10&17\tC|18&19\tD|20&21\tE|22&23\tF|1', | ||
brx: 'B|0\tF|1', | ||
bs: 'B|9&24&25|26&27\tD|9&28&29|30&31\tF|1', | ||
ca: 'B|8&9\tF|1', | ||
ce: 'B|0\tF|1', | ||
ceb: 'B|9&32|9&33|34&35\tF|1', | ||
cgg: 'B|0\tF|1', | ||
chr: 'B|0\tF|1', | ||
ckb: 'B|0\tF|1', | ||
cs: 'B|8&9\tD|36&9\tE|34\tF|1', | ||
cy: 'A|4\tB|0\tC|5\tD|37\tE|38\tF|1', | ||
da: 'B|0|39&40\tF|1', | ||
de: 'B|8&9\tF|1', | ||
dsb: 'B|9&41|42\tC|9&43|44\tD|9&45|46\tF|1', | ||
dv: 'B|0\tF|1', | ||
br: 'B|10&17_C|18&19_D|20&21_E|22&23_F|1', | ||
brx: 'B|0_F|1', | ||
bs: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1', | ||
ca: 'B|8&9_F|1', | ||
ce: 'B|0_F|1', | ||
ceb: 'B|9&32|9&33|34&35_F|1', | ||
cgg: 'B|0_F|1', | ||
chr: 'B|0_F|1', | ||
ckb: 'B|0_F|1', | ||
cs: 'B|8&9_D|36&9_E|34_F|1', | ||
cy: 'A|4_B|0_C|5_D|37_E|38_F|1', | ||
da: 'B|0|39&40_F|1', | ||
de: 'B|8&9_F|1', | ||
dsb: 'B|9&41|42_C|9&43|44_D|9&45|46_F|1', | ||
dv: 'B|0_F|1', | ||
dz: 'F|1', | ||
ee: 'B|0\tF|1', | ||
el: 'B|0\tF|1', | ||
en: 'B|8&9\tF|1', | ||
eo: 'B|0\tF|1', | ||
es: 'B|0\tF|1', | ||
et: 'B|8&9\tF|1', | ||
eu: 'B|0\tF|1', | ||
fa: 'B|3|0\tF|1', | ||
ff: 'B|40\tF|1', | ||
fi: 'B|8&9\tF|1', | ||
fil: 'B|9&32|9&33|34&35\tF|1', | ||
fo: 'B|0\tF|1', | ||
fr: 'B|40\tF|1', | ||
fur: 'B|0\tF|1', | ||
fy: 'B|8&9\tF|1', | ||
ga: 'B|0\tC|5\tD|47\tE|48\tF|1', | ||
gd: 'B|49\tC|50\tD|51\tF|1', | ||
gl: 'B|8&9\tF|1', | ||
gsw: 'B|0\tF|1', | ||
gu: 'B|3|0\tF|1', | ||
guw: 'B|2\tF|1', | ||
gv: 'B|9&24\tC|9&52\tD|9&53\tE|34\tF|1', | ||
ha: 'B|0\tF|1', | ||
haw: 'B|0\tF|1', | ||
he: 'B|8&9\tC|54&9\tE|9&55&14\tF|1', | ||
hi: 'B|3|0\tF|1', | ||
hr: 'B|9&24&25|26&27\tD|9&28&29|30&31\tF|1', | ||
hsb: 'B|9&41|42\tC|9&43|44\tD|9&45|46\tF|1', | ||
hu: 'B|0\tF|1', | ||
hy: 'B|40\tF|1', | ||
ia: 'B|8&9\tF|1', | ||
ee: 'B|0_F|1', | ||
el: 'B|0_F|1', | ||
en: 'B|8&9_F|1', | ||
eo: 'B|0_F|1', | ||
es: 'B|0_F|1', | ||
et: 'B|8&9_F|1', | ||
eu: 'B|0_F|1', | ||
fa: 'B|3|0_F|1', | ||
ff: 'B|40_F|1', | ||
fi: 'B|8&9_F|1', | ||
fil: 'B|9&32|9&33|34&35_F|1', | ||
fo: 'B|0_F|1', | ||
fr: 'B|40_F|1', | ||
fur: 'B|0_F|1', | ||
fy: 'B|8&9_F|1', | ||
ga: 'B|0_C|5_D|47_E|48_F|1', | ||
gd: 'B|49_C|50_D|51_F|1', | ||
gl: 'B|8&9_F|1', | ||
gsw: 'B|0_F|1', | ||
gu: 'B|3|0_F|1', | ||
guw: 'B|2_F|1', | ||
gv: 'B|9&24_C|9&52_D|9&53_E|34_F|1', | ||
ha: 'B|0_F|1', | ||
haw: 'B|0_F|1', | ||
he: 'B|8&9_C|54&9_E|9&55&14_F|1', | ||
hi: 'B|3|0_F|1', | ||
hr: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1', | ||
hsb: 'B|9&41|42_C|9&43|44_D|9&45|46_F|1', | ||
hu: 'B|0_F|1', | ||
hy: 'B|40_F|1', | ||
ia: 'B|8&9_F|1', | ||
id: 'F|1', | ||
@@ -75,144 +75,144 @@ ig: 'F|1', | ||
in: 'F|1', | ||
io: 'B|8&9\tF|1', | ||
is: 'B|56&24&25|39\tF|1', | ||
it: 'B|8&9\tF|1', | ||
iu: 'B|0\tC|5\tF|1', | ||
iw: 'B|8&9\tC|54&9\tE|9&55&14\tF|1', | ||
io: 'B|8&9_F|1', | ||
is: 'B|56&24&25|39_F|1', | ||
it: 'B|8&9_F|1', | ||
iu: 'B|0_C|5_F|1', | ||
iw: 'B|8&9_C|54&9_E|9&55&14_F|1', | ||
ja: 'F|1', | ||
jbo: 'F|1', | ||
jgo: 'B|0\tF|1', | ||
ji: 'B|8&9\tF|1', | ||
jmc: 'B|0\tF|1', | ||
jgo: 'B|0_F|1', | ||
ji: 'B|8&9_F|1', | ||
jmc: 'B|0_F|1', | ||
jv: 'F|1', | ||
jw: 'F|1', | ||
ka: 'B|0\tF|1', | ||
kab: 'B|40\tF|1', | ||
kaj: 'B|0\tF|1', | ||
kcg: 'B|0\tF|1', | ||
ka: 'B|0_F|1', | ||
kab: 'B|40_F|1', | ||
kaj: 'B|0_F|1', | ||
kcg: 'B|0_F|1', | ||
kde: 'F|1', | ||
kea: 'F|1', | ||
kk: 'B|0\tF|1', | ||
kkj: 'B|0\tF|1', | ||
kl: 'B|0\tF|1', | ||
kk: 'B|0_F|1', | ||
kkj: 'B|0_F|1', | ||
kl: 'B|0_F|1', | ||
km: 'F|1', | ||
kn: 'B|3|0\tF|1', | ||
kn: 'B|3|0_F|1', | ||
ko: 'F|1', | ||
ks: 'B|0\tF|1', | ||
ksb: 'B|0\tF|1', | ||
ksh: 'A|4\tB|0\tF|1', | ||
ku: 'B|0\tF|1', | ||
kw: 'A|4\tB|0\tC|57|58&59|22&60\tD|61\tE|62&63\tF|1', | ||
ky: 'B|0\tF|1', | ||
lag: 'A|4\tB|40&22\tF|1', | ||
lb: 'B|0\tF|1', | ||
lg: 'B|0\tF|1', | ||
ks: 'B|0_F|1', | ||
ksb: 'B|0_F|1', | ||
ksh: 'A|4_B|0_F|1', | ||
ku: 'B|0_F|1', | ||
kw: 'A|4_B|0_C|57|58&59|22&60_D|61_E|62&63_F|1', | ||
ky: 'B|0_F|1', | ||
lag: 'A|4_B|40&22_F|1', | ||
lb: 'B|0_F|1', | ||
lg: 'B|0_F|1', | ||
lkt: 'F|1', | ||
ln: 'B|2\tF|1', | ||
ln: 'B|2_F|1', | ||
lo: 'F|1', | ||
lt: 'B|10&64\tD|65&64\tE|66\tF|1', | ||
lv: 'A|14|67|68&69\tB|10&11|68&26&27|70&26\tF|1', | ||
mas: 'B|0\tF|1', | ||
mg: 'B|2\tF|1', | ||
mgo: 'B|0\tF|1', | ||
mk: 'B|9&24&25|26&27\tF|1', | ||
ml: 'B|0\tF|1', | ||
mn: 'B|0\tF|1', | ||
mo: 'B|8&9\tD|34|4|71\tF|1', | ||
mr: 'B|0\tF|1', | ||
lt: 'B|10&64_D|65&64_E|66_F|1', | ||
lv: 'A|14|67|68&69_B|10&11|68&26&27|70&26_F|1', | ||
mas: 'B|0_F|1', | ||
mg: 'B|2_F|1', | ||
mgo: 'B|0_F|1', | ||
mk: 'B|9&24&25|26&27_F|1', | ||
ml: 'B|0_F|1', | ||
mn: 'B|0_F|1', | ||
mo: 'B|8&9_D|34|4|71_F|1', | ||
mr: 'B|0_F|1', | ||
ms: 'F|1', | ||
mt: 'B|0\tD|4|72\tE|67\tF|1', | ||
mt: 'B|0_D|4|72_E|67_F|1', | ||
my: 'F|1', | ||
nah: 'B|0\tF|1', | ||
naq: 'B|0\tC|5\tF|1', | ||
nb: 'B|0\tF|1', | ||
nd: 'B|0\tF|1', | ||
ne: 'B|0\tF|1', | ||
nl: 'B|8&9\tF|1', | ||
nn: 'B|0\tF|1', | ||
nnh: 'B|0\tF|1', | ||
no: 'B|0\tF|1', | ||
nah: 'B|0_F|1', | ||
naq: 'B|0_C|5_F|1', | ||
nb: 'B|0_F|1', | ||
nd: 'B|0_F|1', | ||
ne: 'B|0_F|1', | ||
nl: 'B|8&9_F|1', | ||
nn: 'B|0_F|1', | ||
nnh: 'B|0_F|1', | ||
no: 'B|0_F|1', | ||
nqo: 'F|1', | ||
nr: 'B|0\tF|1', | ||
nso: 'B|2\tF|1', | ||
ny: 'B|0\tF|1', | ||
nyn: 'B|0\tF|1', | ||
om: 'B|0\tF|1', | ||
or: 'B|0\tF|1', | ||
os: 'B|0\tF|1', | ||
nr: 'B|0_F|1', | ||
nso: 'B|2_F|1', | ||
ny: 'B|0_F|1', | ||
nyn: 'B|0_F|1', | ||
om: 'B|0_F|1', | ||
or: 'B|0_F|1', | ||
os: 'B|0_F|1', | ||
osa: 'F|1', | ||
pa: 'B|2\tF|1', | ||
pap: 'B|0\tF|1', | ||
pl: 'B|8&9\tD|9&28&29\tE|9&73&74|9&75|9&76\tF|1', | ||
prg: 'A|14|67|68&69\tB|10&11|68&26&27|70&26\tF|1', | ||
ps: 'B|0\tF|1', | ||
pt: 'B|77\tF|1', | ||
'pt-PT': 'B|8&9\tF|1', | ||
rm: 'B|0\tF|1', | ||
ro: 'B|8&9\tD|34|4|71\tF|1', | ||
rof: 'B|0\tF|1', | ||
pa: 'B|2_F|1', | ||
pap: 'B|0_F|1', | ||
pl: 'B|8&9_D|9&28&29_E|9&73&74|9&75|9&76_F|1', | ||
prg: 'A|14|67|68&69_B|10&11|68&26&27|70&26_F|1', | ||
ps: 'B|0_F|1', | ||
pt: 'B|77_F|1', | ||
'pt-PT': 'B|8&9_F|1', | ||
rm: 'B|0_F|1', | ||
ro: 'B|8&9_D|34|4|71_F|1', | ||
rof: 'B|0_F|1', | ||
root: 'F|1', | ||
ru: 'B|9&24&25\tD|9&28&29\tE|9&78|9&75|9&79\tF|1', | ||
rwk: 'B|0\tF|1', | ||
ru: 'B|9&24&25_D|9&28&29_E|9&78|9&75|9&79_F|1', | ||
rwk: 'B|0_F|1', | ||
sah: 'F|1', | ||
saq: 'B|0\tF|1', | ||
sc: 'B|8&9\tF|1', | ||
scn: 'B|8&9\tF|1', | ||
sd: 'B|0\tF|1', | ||
sdh: 'B|0\tF|1', | ||
se: 'B|0\tC|5\tF|1', | ||
seh: 'B|0\tF|1', | ||
saq: 'B|0_F|1', | ||
sc: 'B|8&9_F|1', | ||
scn: 'B|8&9_F|1', | ||
sd: 'B|0_F|1', | ||
sdh: 'B|0_F|1', | ||
se: 'B|0_C|5_F|1', | ||
seh: 'B|0_F|1', | ||
ses: 'F|1', | ||
sg: 'F|1', | ||
sh: 'B|9&24&25|26&27\tD|9&28&29|30&31\tF|1', | ||
shi: 'B|3|0\tD|80\tF|1', | ||
si: 'B|81|3&82\tF|1', | ||
sk: 'B|8&9\tD|36&9\tE|34\tF|1', | ||
sl: 'B|9&41\tC|9&43\tD|9&45|34\tF|1', | ||
sma: 'B|0\tC|5\tF|1', | ||
smi: 'B|0\tC|5\tF|1', | ||
smj: 'B|0\tC|5\tF|1', | ||
smn: 'B|0\tC|5\tF|1', | ||
sms: 'B|0\tC|5\tF|1', | ||
sn: 'B|0\tF|1', | ||
so: 'B|0\tF|1', | ||
sq: 'B|0\tF|1', | ||
sr: 'B|9&24&25|26&27\tD|9&28&29|30&31\tF|1', | ||
ss: 'B|0\tF|1', | ||
ssy: 'B|0\tF|1', | ||
st: 'B|0\tF|1', | ||
sh: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1', | ||
shi: 'B|3|0_D|80_F|1', | ||
si: 'B|81|3&82_F|1', | ||
sk: 'B|8&9_D|36&9_E|34_F|1', | ||
sl: 'B|9&41_C|9&43_D|9&45|34_F|1', | ||
sma: 'B|0_C|5_F|1', | ||
smi: 'B|0_C|5_F|1', | ||
smj: 'B|0_C|5_F|1', | ||
smn: 'B|0_C|5_F|1', | ||
sms: 'B|0_C|5_F|1', | ||
sn: 'B|0_F|1', | ||
so: 'B|0_F|1', | ||
sq: 'B|0_F|1', | ||
sr: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1', | ||
ss: 'B|0_F|1', | ||
ssy: 'B|0_F|1', | ||
st: 'B|0_F|1', | ||
su: 'F|1', | ||
sv: 'B|8&9\tF|1', | ||
sw: 'B|8&9\tF|1', | ||
syr: 'B|0\tF|1', | ||
ta: 'B|0\tF|1', | ||
te: 'B|0\tF|1', | ||
teo: 'B|0\tF|1', | ||
sv: 'B|8&9_F|1', | ||
sw: 'B|8&9_F|1', | ||
syr: 'B|0_F|1', | ||
ta: 'B|0_F|1', | ||
te: 'B|0_F|1', | ||
teo: 'B|0_F|1', | ||
th: 'F|1', | ||
ti: 'B|2\tF|1', | ||
tig: 'B|0\tF|1', | ||
tk: 'B|0\tF|1', | ||
tl: 'B|9&32|9&33|34&35\tF|1', | ||
tn: 'B|0\tF|1', | ||
ti: 'B|2_F|1', | ||
tig: 'B|0_F|1', | ||
tk: 'B|0_F|1', | ||
tl: 'B|9&32|9&33|34&35_F|1', | ||
tn: 'B|0_F|1', | ||
to: 'F|1', | ||
tr: 'B|0\tF|1', | ||
ts: 'B|0\tF|1', | ||
tzm: 'B|2|83\tF|1', | ||
ug: 'B|0\tF|1', | ||
uk: 'B|9&24&25\tD|9&28&29\tE|9&78|9&75|9&79\tF|1', | ||
ur: 'B|8&9\tF|1', | ||
uz: 'B|0\tF|1', | ||
ve: 'B|0\tF|1', | ||
tr: 'B|0_F|1', | ||
ts: 'B|0_F|1', | ||
tzm: 'B|2|83_F|1', | ||
ug: 'B|0_F|1', | ||
uk: 'B|9&24&25_D|9&28&29_E|9&78|9&75|9&79_F|1', | ||
ur: 'B|8&9_F|1', | ||
uz: 'B|0_F|1', | ||
ve: 'B|0_F|1', | ||
vi: 'F|1', | ||
vo: 'B|0\tF|1', | ||
vun: 'B|0\tF|1', | ||
wa: 'B|2\tF|1', | ||
wae: 'B|0\tF|1', | ||
vo: 'B|0_F|1', | ||
vun: 'B|0_F|1', | ||
wa: 'B|2_F|1', | ||
wae: 'B|0_F|1', | ||
wo: 'F|1', | ||
xh: 'B|0\tF|1', | ||
xog: 'B|0\tF|1', | ||
yi: 'B|8&9\tF|1', | ||
xh: 'B|0_F|1', | ||
xog: 'B|0_F|1', | ||
yi: 'B|8&9_F|1', | ||
yo: 'F|1', | ||
yue: 'F|1', | ||
zh: 'F|1', | ||
zu: 'B|3|0\tF|1' | ||
zu: 'B|3|0_F|1' | ||
}; | ||
@@ -224,12 +224,12 @@ export var ordinalRules = { | ||
ar: 'F|1', | ||
as: 'B|84\tC|85\tD|86\tE|38\tF|1', | ||
az: 'B|87|88\tD|89|90\tE|3|91|92\tF|1', | ||
be: 'D|93&94\tF|1', | ||
as: 'B|84_C|85_D|86_E|38_F|1', | ||
az: 'B|87|88_D|89|90_E|3|91|92_F|1', | ||
be: 'D|93&94_F|1', | ||
bg: 'F|1', | ||
bn: 'B|84\tC|85\tD|86\tE|38\tF|1', | ||
bn: 'B|84_C|85_D|86_E|38_F|1', | ||
bs: 'F|1', | ||
ca: 'B|95\tC|5\tD|86\tF|1', | ||
ca: 'B|95_C|5_D|86_F|1', | ||
ce: 'F|1', | ||
cs: 'F|1', | ||
cy: 'A|96\tB|0\tC|5\tD|97\tE|98\tF|1', | ||
cy: 'A|96_B|0_C|5_D|97_E|98_F|1', | ||
da: 'F|1', | ||
@@ -239,3 +239,3 @@ de: 'F|1', | ||
el: 'F|1', | ||
en: 'B|10&11\tC|18&99\tD|100&101\tF|1', | ||
en: 'B|10&11_C|18&99_D|100&101_F|1', | ||
es: 'F|1', | ||
@@ -246,16 +246,16 @@ et: 'F|1', | ||
fi: 'F|1', | ||
fil: 'B|0\tF|1', | ||
fr: 'B|0\tF|1', | ||
fil: 'B|0_F|1', | ||
fr: 'B|0_F|1', | ||
fy: 'F|1', | ||
ga: 'B|0\tF|1', | ||
gd: 'B|49\tC|50\tD|102\tF|1', | ||
ga: 'B|0_F|1', | ||
gd: 'B|49_C|50_D|102_F|1', | ||
gl: 'F|1', | ||
gsw: 'F|1', | ||
gu: 'B|0\tC|85\tD|86\tE|38\tF|1', | ||
gu: 'B|0_C|85_D|86_E|38_F|1', | ||
he: 'F|1', | ||
hi: 'B|0\tC|85\tD|86\tE|38\tF|1', | ||
hi: 'B|0_C|85_D|86_E|38_F|1', | ||
hr: 'F|1', | ||
hsb: 'F|1', | ||
hu: 'B|103\tF|1', | ||
hy: 'B|0\tF|1', | ||
hu: 'B|103_F|1', | ||
hy: 'B|0_F|1', | ||
ia: 'F|1', | ||
@@ -265,26 +265,26 @@ id: 'F|1', | ||
is: 'F|1', | ||
it: 'E|104\tF|1', | ||
it: 'E|104_F|1', | ||
iw: 'F|1', | ||
ja: 'F|1', | ||
ka: 'B|8\tE|3|105\tF|1', | ||
kk: 'E|106|107|14&22\tF|1', | ||
ka: 'B|8_E|3|105_F|1', | ||
kk: 'E|106|107|14&22_F|1', | ||
km: 'F|1', | ||
kn: 'F|1', | ||
ko: 'F|1', | ||
kw: 'B|108|109\tE|110|111\tF|1', | ||
kw: 'B|108|109_E|110|111_F|1', | ||
ky: 'F|1', | ||
lo: 'B|0\tF|1', | ||
lo: 'B|0_F|1', | ||
lt: 'F|1', | ||
lv: 'F|1', | ||
mk: 'B|24&25\tC|52&112\tE|113&114\tF|1', | ||
mk: 'B|24&25_C|52&112_E|113&114_F|1', | ||
ml: 'F|1', | ||
mn: 'F|1', | ||
mo: 'B|0\tF|1', | ||
mr: 'B|0\tC|85\tD|86\tF|1', | ||
ms: 'B|0\tF|1', | ||
mo: 'B|0_F|1', | ||
mr: 'B|0_C|85_D|86_F|1', | ||
ms: 'B|0_F|1', | ||
my: 'F|1', | ||
nb: 'F|1', | ||
ne: 'B|108\tF|1', | ||
ne: 'B|108_F|1', | ||
nl: 'F|1', | ||
or: 'B|115\tC|85\tD|86\tE|38\tF|1', | ||
or: 'B|115_C|85_D|86_E|38_F|1', | ||
pa: 'F|1', | ||
@@ -295,7 +295,7 @@ pl: 'F|1', | ||
pt: 'F|1', | ||
ro: 'B|0\tF|1', | ||
ro: 'B|0_F|1', | ||
root: 'F|1', | ||
ru: 'F|1', | ||
sc: 'E|104\tF|1', | ||
scn: 'E|104\tF|1', | ||
sc: 'E|104_F|1', | ||
scn: 'E|104_F|1', | ||
sd: 'F|1', | ||
@@ -306,5 +306,5 @@ sh: 'F|1', | ||
sl: 'F|1', | ||
sq: 'B|0\tE|116&117\tF|1', | ||
sq: 'B|0_E|116&117_F|1', | ||
sr: 'F|1', | ||
sv: 'B|118&119\tF|1', | ||
sv: 'B|118&119_F|1', | ||
sw: 'F|1', | ||
@@ -314,9 +314,9 @@ ta: 'F|1', | ||
th: 'F|1', | ||
tk: 'D|120|121\tF|1', | ||
tl: 'B|0\tF|1', | ||
tk: 'D|120|121_F|1', | ||
tl: 'B|0_F|1', | ||
tr: 'F|1', | ||
uk: 'D|100&101\tF|1', | ||
uk: 'D|100&101_F|1', | ||
ur: 'F|1', | ||
uz: 'F|1', | ||
vi: 'B|0\tF|1', | ||
vi: 'B|0_F|1', | ||
yue: 'F|1', | ||
@@ -323,0 +323,0 @@ zh: 'F|1', |
@@ -0,2 +1,3 @@ | ||
export { NumberOperands } from './operands'; | ||
import { PluralRules } from './types'; | ||
export declare const pluralRules: PluralRules; |
import { cardinalRules, expressions, ordinalRules } from './autogen.rules'; | ||
export { NumberOperands } from './operands'; | ||
import { PluralRules } from './types'; | ||
export var pluralRules = new PluralRules(expressions, cardinalRules, ordinalRules); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,3 @@ | ||
import { NumberOperands } from '@phensley/decimal'; | ||
import { Decimal } from '@phensley/decimal'; | ||
import { NumberOperands } from './operands'; | ||
export declare type RuleMap = { | ||
@@ -9,2 +10,10 @@ [x: string]: PluralRule; | ||
export declare type Operand = 'n' | 'i' | 'v' | 'w' | 'f' | 't'; | ||
export declare const enum Op { | ||
N = 0, | ||
I = 1, | ||
V = 2, | ||
W = 4, | ||
F = 8, | ||
T = 16 | ||
} | ||
export declare class RuleCache { | ||
@@ -26,4 +35,5 @@ private strings; | ||
constructor(expressionsRaw: string[], cardinalsRaw: StringMap, ordinalsRaw: StringMap); | ||
cardinal(language: string, operands: NumberOperands): string; | ||
ordinal(language: string, operands: NumberOperands): string; | ||
operands(d: Decimal): NumberOperands; | ||
cardinal(language: string, n: Decimal): string; | ||
ordinal(language: string, n: Decimal): string; | ||
private evaluate; | ||
@@ -55,6 +65,6 @@ private execute; | ||
readonly operator: string; | ||
readonly mod: number; | ||
readonly ranges: (number | number[])[]; | ||
readonly mod?: Decimal; | ||
readonly ranges: (Decimal | Decimal[])[]; | ||
constructor(raw: string); | ||
} | ||
export declare const evaluateExpr: (operands: NumberOperands, expr: PluralExpr) => boolean; |
@@ -0,1 +1,3 @@ | ||
import { Decimal } from '@phensley/decimal'; | ||
import { NumberOperands } from './operands'; | ||
// Notation for categories in compact plural rules | ||
@@ -41,8 +43,11 @@ var CATEGORIES = { | ||
} | ||
PluralRules.prototype.cardinal = function (language, operands) { | ||
return this.evaluate(language, operands, this.cardinals); | ||
PluralRules.prototype.operands = function (d) { | ||
return new NumberOperands(d); | ||
}; | ||
PluralRules.prototype.ordinal = function (language, operands) { | ||
return this.evaluate(language, operands, this.ordinals); | ||
PluralRules.prototype.cardinal = function (language, n) { | ||
return this.evaluate(language, new NumberOperands(n), this.cardinals); | ||
}; | ||
PluralRules.prototype.ordinal = function (language, n) { | ||
return this.evaluate(language, new NumberOperands(n), this.ordinals); | ||
}; | ||
PluralRules.prototype.evaluate = function (language, operands, cache) { | ||
@@ -101,3 +106,3 @@ var rule = cache.get(language); | ||
function PluralRule(raw) { | ||
this.conditions = raw.split('\t').map(function (s) { return new PluralCond(s); }); | ||
this.conditions = raw.split('_').map(function (s) { return new PluralCond(s); }); | ||
} | ||
@@ -127,3 +132,3 @@ return PluralRule; | ||
this.operator = '='; | ||
this.mod = 0; | ||
var mod = 0; | ||
var i = 1; | ||
@@ -143,4 +148,4 @@ while (i < raw.length) { | ||
case '9': | ||
this.mod *= 10; | ||
this.mod += Number(ch); | ||
mod *= 10; | ||
mod += Number(ch); | ||
break; | ||
@@ -160,4 +165,8 @@ case '!': | ||
} | ||
this.ranges = raw.substring(i).split(',') | ||
.map(function (s) { return s.indexOf(':') === -1 ? Number(s) : s.split(':').map(Number); }); | ||
if (mod) { | ||
this.mod = new Decimal(mod); | ||
} | ||
raw = raw.substring(i); | ||
this.ranges = raw ? raw.split(',') | ||
.map(function (s) { return s.indexOf(':') === -1 ? new Decimal(s) : s.split(':').map(function (x) { return new Decimal(x); }); }) : []; | ||
} | ||
@@ -169,13 +178,10 @@ return PluralExpr; | ||
var operand = expr.operand, ranges = expr.ranges; | ||
if (!operand) { | ||
return false; | ||
} | ||
var n = operands[operand]; | ||
// If we're applying modulus to the 'n' operand we must also ensure | ||
// decimal value is zero. | ||
if (expr.operand === 'n') { | ||
if (operands.f !== 0) { | ||
return false; | ||
} | ||
if (expr.mod) { | ||
n = n.divmod(expr.mod)[1]; | ||
} | ||
if (expr.mod !== 0) { | ||
n = n % expr.mod; | ||
} | ||
var integer = n.isInteger(); | ||
var equals = expr.operator !== '!'; | ||
@@ -186,7 +192,7 @@ var len = ranges.length; | ||
var elem = ranges[i]; | ||
if (typeof elem === 'number') { | ||
res = res || n === elem; | ||
if (elem instanceof Decimal) { | ||
res = res || n.compare(elem) === 0; | ||
} | ||
else { | ||
res = res || (n >= elem[0] && n <= elem[1]); | ||
res = res || (integer && n.compare(elem[0]) >= 0 && n.compare(elem[1]) <= 0); | ||
} | ||
@@ -193,0 +199,0 @@ } |
@@ -7,67 +7,67 @@ "use strict"; | ||
exports.cardinalRules = { | ||
af: 'B|0\tF|1', | ||
ak: 'B|2\tF|1', | ||
am: 'B|3|0\tF|1', | ||
an: 'B|0\tF|1', | ||
ar: 'A|4\tB|0\tC|5\tD|6\tE|7\tF|1', | ||
ars: 'A|4\tB|0\tC|5\tD|6\tE|7\tF|1', | ||
as: 'B|3|0\tF|1', | ||
asa: 'B|0\tF|1', | ||
ast: 'B|8&9\tF|1', | ||
az: 'B|0\tF|1', | ||
be: 'B|10&11\tD|12&13\tE|14|15|16\tF|1', | ||
bem: 'B|0\tF|1', | ||
bez: 'B|0\tF|1', | ||
bg: 'B|0\tF|1', | ||
bho: 'B|2\tF|1', | ||
af: 'B|0_F|1', | ||
ak: 'B|2_F|1', | ||
am: 'B|3|0_F|1', | ||
an: 'B|0_F|1', | ||
ar: 'A|4_B|0_C|5_D|6_E|7_F|1', | ||
ars: 'A|4_B|0_C|5_D|6_E|7_F|1', | ||
as: 'B|3|0_F|1', | ||
asa: 'B|0_F|1', | ||
ast: 'B|8&9_F|1', | ||
az: 'B|0_F|1', | ||
be: 'B|10&11_D|12&13_E|14|15|16_F|1', | ||
bem: 'B|0_F|1', | ||
bez: 'B|0_F|1', | ||
bg: 'B|0_F|1', | ||
bho: 'B|2_F|1', | ||
bm: 'F|1', | ||
bn: 'B|3|0\tF|1', | ||
bn: 'B|3|0_F|1', | ||
bo: 'F|1', | ||
br: 'B|10&17\tC|18&19\tD|20&21\tE|22&23\tF|1', | ||
brx: 'B|0\tF|1', | ||
bs: 'B|9&24&25|26&27\tD|9&28&29|30&31\tF|1', | ||
ca: 'B|8&9\tF|1', | ||
ce: 'B|0\tF|1', | ||
ceb: 'B|9&32|9&33|34&35\tF|1', | ||
cgg: 'B|0\tF|1', | ||
chr: 'B|0\tF|1', | ||
ckb: 'B|0\tF|1', | ||
cs: 'B|8&9\tD|36&9\tE|34\tF|1', | ||
cy: 'A|4\tB|0\tC|5\tD|37\tE|38\tF|1', | ||
da: 'B|0|39&40\tF|1', | ||
de: 'B|8&9\tF|1', | ||
dsb: 'B|9&41|42\tC|9&43|44\tD|9&45|46\tF|1', | ||
dv: 'B|0\tF|1', | ||
br: 'B|10&17_C|18&19_D|20&21_E|22&23_F|1', | ||
brx: 'B|0_F|1', | ||
bs: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1', | ||
ca: 'B|8&9_F|1', | ||
ce: 'B|0_F|1', | ||
ceb: 'B|9&32|9&33|34&35_F|1', | ||
cgg: 'B|0_F|1', | ||
chr: 'B|0_F|1', | ||
ckb: 'B|0_F|1', | ||
cs: 'B|8&9_D|36&9_E|34_F|1', | ||
cy: 'A|4_B|0_C|5_D|37_E|38_F|1', | ||
da: 'B|0|39&40_F|1', | ||
de: 'B|8&9_F|1', | ||
dsb: 'B|9&41|42_C|9&43|44_D|9&45|46_F|1', | ||
dv: 'B|0_F|1', | ||
dz: 'F|1', | ||
ee: 'B|0\tF|1', | ||
el: 'B|0\tF|1', | ||
en: 'B|8&9\tF|1', | ||
eo: 'B|0\tF|1', | ||
es: 'B|0\tF|1', | ||
et: 'B|8&9\tF|1', | ||
eu: 'B|0\tF|1', | ||
fa: 'B|3|0\tF|1', | ||
ff: 'B|40\tF|1', | ||
fi: 'B|8&9\tF|1', | ||
fil: 'B|9&32|9&33|34&35\tF|1', | ||
fo: 'B|0\tF|1', | ||
fr: 'B|40\tF|1', | ||
fur: 'B|0\tF|1', | ||
fy: 'B|8&9\tF|1', | ||
ga: 'B|0\tC|5\tD|47\tE|48\tF|1', | ||
gd: 'B|49\tC|50\tD|51\tF|1', | ||
gl: 'B|8&9\tF|1', | ||
gsw: 'B|0\tF|1', | ||
gu: 'B|3|0\tF|1', | ||
guw: 'B|2\tF|1', | ||
gv: 'B|9&24\tC|9&52\tD|9&53\tE|34\tF|1', | ||
ha: 'B|0\tF|1', | ||
haw: 'B|0\tF|1', | ||
he: 'B|8&9\tC|54&9\tE|9&55&14\tF|1', | ||
hi: 'B|3|0\tF|1', | ||
hr: 'B|9&24&25|26&27\tD|9&28&29|30&31\tF|1', | ||
hsb: 'B|9&41|42\tC|9&43|44\tD|9&45|46\tF|1', | ||
hu: 'B|0\tF|1', | ||
hy: 'B|40\tF|1', | ||
ia: 'B|8&9\tF|1', | ||
ee: 'B|0_F|1', | ||
el: 'B|0_F|1', | ||
en: 'B|8&9_F|1', | ||
eo: 'B|0_F|1', | ||
es: 'B|0_F|1', | ||
et: 'B|8&9_F|1', | ||
eu: 'B|0_F|1', | ||
fa: 'B|3|0_F|1', | ||
ff: 'B|40_F|1', | ||
fi: 'B|8&9_F|1', | ||
fil: 'B|9&32|9&33|34&35_F|1', | ||
fo: 'B|0_F|1', | ||
fr: 'B|40_F|1', | ||
fur: 'B|0_F|1', | ||
fy: 'B|8&9_F|1', | ||
ga: 'B|0_C|5_D|47_E|48_F|1', | ||
gd: 'B|49_C|50_D|51_F|1', | ||
gl: 'B|8&9_F|1', | ||
gsw: 'B|0_F|1', | ||
gu: 'B|3|0_F|1', | ||
guw: 'B|2_F|1', | ||
gv: 'B|9&24_C|9&52_D|9&53_E|34_F|1', | ||
ha: 'B|0_F|1', | ||
haw: 'B|0_F|1', | ||
he: 'B|8&9_C|54&9_E|9&55&14_F|1', | ||
hi: 'B|3|0_F|1', | ||
hr: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1', | ||
hsb: 'B|9&41|42_C|9&43|44_D|9&45|46_F|1', | ||
hu: 'B|0_F|1', | ||
hy: 'B|40_F|1', | ||
ia: 'B|8&9_F|1', | ||
id: 'F|1', | ||
@@ -77,144 +77,144 @@ ig: 'F|1', | ||
in: 'F|1', | ||
io: 'B|8&9\tF|1', | ||
is: 'B|56&24&25|39\tF|1', | ||
it: 'B|8&9\tF|1', | ||
iu: 'B|0\tC|5\tF|1', | ||
iw: 'B|8&9\tC|54&9\tE|9&55&14\tF|1', | ||
io: 'B|8&9_F|1', | ||
is: 'B|56&24&25|39_F|1', | ||
it: 'B|8&9_F|1', | ||
iu: 'B|0_C|5_F|1', | ||
iw: 'B|8&9_C|54&9_E|9&55&14_F|1', | ||
ja: 'F|1', | ||
jbo: 'F|1', | ||
jgo: 'B|0\tF|1', | ||
ji: 'B|8&9\tF|1', | ||
jmc: 'B|0\tF|1', | ||
jgo: 'B|0_F|1', | ||
ji: 'B|8&9_F|1', | ||
jmc: 'B|0_F|1', | ||
jv: 'F|1', | ||
jw: 'F|1', | ||
ka: 'B|0\tF|1', | ||
kab: 'B|40\tF|1', | ||
kaj: 'B|0\tF|1', | ||
kcg: 'B|0\tF|1', | ||
ka: 'B|0_F|1', | ||
kab: 'B|40_F|1', | ||
kaj: 'B|0_F|1', | ||
kcg: 'B|0_F|1', | ||
kde: 'F|1', | ||
kea: 'F|1', | ||
kk: 'B|0\tF|1', | ||
kkj: 'B|0\tF|1', | ||
kl: 'B|0\tF|1', | ||
kk: 'B|0_F|1', | ||
kkj: 'B|0_F|1', | ||
kl: 'B|0_F|1', | ||
km: 'F|1', | ||
kn: 'B|3|0\tF|1', | ||
kn: 'B|3|0_F|1', | ||
ko: 'F|1', | ||
ks: 'B|0\tF|1', | ||
ksb: 'B|0\tF|1', | ||
ksh: 'A|4\tB|0\tF|1', | ||
ku: 'B|0\tF|1', | ||
kw: 'A|4\tB|0\tC|57|58&59|22&60\tD|61\tE|62&63\tF|1', | ||
ky: 'B|0\tF|1', | ||
lag: 'A|4\tB|40&22\tF|1', | ||
lb: 'B|0\tF|1', | ||
lg: 'B|0\tF|1', | ||
ks: 'B|0_F|1', | ||
ksb: 'B|0_F|1', | ||
ksh: 'A|4_B|0_F|1', | ||
ku: 'B|0_F|1', | ||
kw: 'A|4_B|0_C|57|58&59|22&60_D|61_E|62&63_F|1', | ||
ky: 'B|0_F|1', | ||
lag: 'A|4_B|40&22_F|1', | ||
lb: 'B|0_F|1', | ||
lg: 'B|0_F|1', | ||
lkt: 'F|1', | ||
ln: 'B|2\tF|1', | ||
ln: 'B|2_F|1', | ||
lo: 'F|1', | ||
lt: 'B|10&64\tD|65&64\tE|66\tF|1', | ||
lv: 'A|14|67|68&69\tB|10&11|68&26&27|70&26\tF|1', | ||
mas: 'B|0\tF|1', | ||
mg: 'B|2\tF|1', | ||
mgo: 'B|0\tF|1', | ||
mk: 'B|9&24&25|26&27\tF|1', | ||
ml: 'B|0\tF|1', | ||
mn: 'B|0\tF|1', | ||
mo: 'B|8&9\tD|34|4|71\tF|1', | ||
mr: 'B|0\tF|1', | ||
lt: 'B|10&64_D|65&64_E|66_F|1', | ||
lv: 'A|14|67|68&69_B|10&11|68&26&27|70&26_F|1', | ||
mas: 'B|0_F|1', | ||
mg: 'B|2_F|1', | ||
mgo: 'B|0_F|1', | ||
mk: 'B|9&24&25|26&27_F|1', | ||
ml: 'B|0_F|1', | ||
mn: 'B|0_F|1', | ||
mo: 'B|8&9_D|34|4|71_F|1', | ||
mr: 'B|0_F|1', | ||
ms: 'F|1', | ||
mt: 'B|0\tD|4|72\tE|67\tF|1', | ||
mt: 'B|0_D|4|72_E|67_F|1', | ||
my: 'F|1', | ||
nah: 'B|0\tF|1', | ||
naq: 'B|0\tC|5\tF|1', | ||
nb: 'B|0\tF|1', | ||
nd: 'B|0\tF|1', | ||
ne: 'B|0\tF|1', | ||
nl: 'B|8&9\tF|1', | ||
nn: 'B|0\tF|1', | ||
nnh: 'B|0\tF|1', | ||
no: 'B|0\tF|1', | ||
nah: 'B|0_F|1', | ||
naq: 'B|0_C|5_F|1', | ||
nb: 'B|0_F|1', | ||
nd: 'B|0_F|1', | ||
ne: 'B|0_F|1', | ||
nl: 'B|8&9_F|1', | ||
nn: 'B|0_F|1', | ||
nnh: 'B|0_F|1', | ||
no: 'B|0_F|1', | ||
nqo: 'F|1', | ||
nr: 'B|0\tF|1', | ||
nso: 'B|2\tF|1', | ||
ny: 'B|0\tF|1', | ||
nyn: 'B|0\tF|1', | ||
om: 'B|0\tF|1', | ||
or: 'B|0\tF|1', | ||
os: 'B|0\tF|1', | ||
nr: 'B|0_F|1', | ||
nso: 'B|2_F|1', | ||
ny: 'B|0_F|1', | ||
nyn: 'B|0_F|1', | ||
om: 'B|0_F|1', | ||
or: 'B|0_F|1', | ||
os: 'B|0_F|1', | ||
osa: 'F|1', | ||
pa: 'B|2\tF|1', | ||
pap: 'B|0\tF|1', | ||
pl: 'B|8&9\tD|9&28&29\tE|9&73&74|9&75|9&76\tF|1', | ||
prg: 'A|14|67|68&69\tB|10&11|68&26&27|70&26\tF|1', | ||
ps: 'B|0\tF|1', | ||
pt: 'B|77\tF|1', | ||
'pt-PT': 'B|8&9\tF|1', | ||
rm: 'B|0\tF|1', | ||
ro: 'B|8&9\tD|34|4|71\tF|1', | ||
rof: 'B|0\tF|1', | ||
pa: 'B|2_F|1', | ||
pap: 'B|0_F|1', | ||
pl: 'B|8&9_D|9&28&29_E|9&73&74|9&75|9&76_F|1', | ||
prg: 'A|14|67|68&69_B|10&11|68&26&27|70&26_F|1', | ||
ps: 'B|0_F|1', | ||
pt: 'B|77_F|1', | ||
'pt-PT': 'B|8&9_F|1', | ||
rm: 'B|0_F|1', | ||
ro: 'B|8&9_D|34|4|71_F|1', | ||
rof: 'B|0_F|1', | ||
root: 'F|1', | ||
ru: 'B|9&24&25\tD|9&28&29\tE|9&78|9&75|9&79\tF|1', | ||
rwk: 'B|0\tF|1', | ||
ru: 'B|9&24&25_D|9&28&29_E|9&78|9&75|9&79_F|1', | ||
rwk: 'B|0_F|1', | ||
sah: 'F|1', | ||
saq: 'B|0\tF|1', | ||
sc: 'B|8&9\tF|1', | ||
scn: 'B|8&9\tF|1', | ||
sd: 'B|0\tF|1', | ||
sdh: 'B|0\tF|1', | ||
se: 'B|0\tC|5\tF|1', | ||
seh: 'B|0\tF|1', | ||
saq: 'B|0_F|1', | ||
sc: 'B|8&9_F|1', | ||
scn: 'B|8&9_F|1', | ||
sd: 'B|0_F|1', | ||
sdh: 'B|0_F|1', | ||
se: 'B|0_C|5_F|1', | ||
seh: 'B|0_F|1', | ||
ses: 'F|1', | ||
sg: 'F|1', | ||
sh: 'B|9&24&25|26&27\tD|9&28&29|30&31\tF|1', | ||
shi: 'B|3|0\tD|80\tF|1', | ||
si: 'B|81|3&82\tF|1', | ||
sk: 'B|8&9\tD|36&9\tE|34\tF|1', | ||
sl: 'B|9&41\tC|9&43\tD|9&45|34\tF|1', | ||
sma: 'B|0\tC|5\tF|1', | ||
smi: 'B|0\tC|5\tF|1', | ||
smj: 'B|0\tC|5\tF|1', | ||
smn: 'B|0\tC|5\tF|1', | ||
sms: 'B|0\tC|5\tF|1', | ||
sn: 'B|0\tF|1', | ||
so: 'B|0\tF|1', | ||
sq: 'B|0\tF|1', | ||
sr: 'B|9&24&25|26&27\tD|9&28&29|30&31\tF|1', | ||
ss: 'B|0\tF|1', | ||
ssy: 'B|0\tF|1', | ||
st: 'B|0\tF|1', | ||
sh: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1', | ||
shi: 'B|3|0_D|80_F|1', | ||
si: 'B|81|3&82_F|1', | ||
sk: 'B|8&9_D|36&9_E|34_F|1', | ||
sl: 'B|9&41_C|9&43_D|9&45|34_F|1', | ||
sma: 'B|0_C|5_F|1', | ||
smi: 'B|0_C|5_F|1', | ||
smj: 'B|0_C|5_F|1', | ||
smn: 'B|0_C|5_F|1', | ||
sms: 'B|0_C|5_F|1', | ||
sn: 'B|0_F|1', | ||
so: 'B|0_F|1', | ||
sq: 'B|0_F|1', | ||
sr: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1', | ||
ss: 'B|0_F|1', | ||
ssy: 'B|0_F|1', | ||
st: 'B|0_F|1', | ||
su: 'F|1', | ||
sv: 'B|8&9\tF|1', | ||
sw: 'B|8&9\tF|1', | ||
syr: 'B|0\tF|1', | ||
ta: 'B|0\tF|1', | ||
te: 'B|0\tF|1', | ||
teo: 'B|0\tF|1', | ||
sv: 'B|8&9_F|1', | ||
sw: 'B|8&9_F|1', | ||
syr: 'B|0_F|1', | ||
ta: 'B|0_F|1', | ||
te: 'B|0_F|1', | ||
teo: 'B|0_F|1', | ||
th: 'F|1', | ||
ti: 'B|2\tF|1', | ||
tig: 'B|0\tF|1', | ||
tk: 'B|0\tF|1', | ||
tl: 'B|9&32|9&33|34&35\tF|1', | ||
tn: 'B|0\tF|1', | ||
ti: 'B|2_F|1', | ||
tig: 'B|0_F|1', | ||
tk: 'B|0_F|1', | ||
tl: 'B|9&32|9&33|34&35_F|1', | ||
tn: 'B|0_F|1', | ||
to: 'F|1', | ||
tr: 'B|0\tF|1', | ||
ts: 'B|0\tF|1', | ||
tzm: 'B|2|83\tF|1', | ||
ug: 'B|0\tF|1', | ||
uk: 'B|9&24&25\tD|9&28&29\tE|9&78|9&75|9&79\tF|1', | ||
ur: 'B|8&9\tF|1', | ||
uz: 'B|0\tF|1', | ||
ve: 'B|0\tF|1', | ||
tr: 'B|0_F|1', | ||
ts: 'B|0_F|1', | ||
tzm: 'B|2|83_F|1', | ||
ug: 'B|0_F|1', | ||
uk: 'B|9&24&25_D|9&28&29_E|9&78|9&75|9&79_F|1', | ||
ur: 'B|8&9_F|1', | ||
uz: 'B|0_F|1', | ||
ve: 'B|0_F|1', | ||
vi: 'F|1', | ||
vo: 'B|0\tF|1', | ||
vun: 'B|0\tF|1', | ||
wa: 'B|2\tF|1', | ||
wae: 'B|0\tF|1', | ||
vo: 'B|0_F|1', | ||
vun: 'B|0_F|1', | ||
wa: 'B|2_F|1', | ||
wae: 'B|0_F|1', | ||
wo: 'F|1', | ||
xh: 'B|0\tF|1', | ||
xog: 'B|0\tF|1', | ||
yi: 'B|8&9\tF|1', | ||
xh: 'B|0_F|1', | ||
xog: 'B|0_F|1', | ||
yi: 'B|8&9_F|1', | ||
yo: 'F|1', | ||
yue: 'F|1', | ||
zh: 'F|1', | ||
zu: 'B|3|0\tF|1' | ||
zu: 'B|3|0_F|1' | ||
}; | ||
@@ -226,12 +226,12 @@ exports.ordinalRules = { | ||
ar: 'F|1', | ||
as: 'B|84\tC|85\tD|86\tE|38\tF|1', | ||
az: 'B|87|88\tD|89|90\tE|3|91|92\tF|1', | ||
be: 'D|93&94\tF|1', | ||
as: 'B|84_C|85_D|86_E|38_F|1', | ||
az: 'B|87|88_D|89|90_E|3|91|92_F|1', | ||
be: 'D|93&94_F|1', | ||
bg: 'F|1', | ||
bn: 'B|84\tC|85\tD|86\tE|38\tF|1', | ||
bn: 'B|84_C|85_D|86_E|38_F|1', | ||
bs: 'F|1', | ||
ca: 'B|95\tC|5\tD|86\tF|1', | ||
ca: 'B|95_C|5_D|86_F|1', | ||
ce: 'F|1', | ||
cs: 'F|1', | ||
cy: 'A|96\tB|0\tC|5\tD|97\tE|98\tF|1', | ||
cy: 'A|96_B|0_C|5_D|97_E|98_F|1', | ||
da: 'F|1', | ||
@@ -241,3 +241,3 @@ de: 'F|1', | ||
el: 'F|1', | ||
en: 'B|10&11\tC|18&99\tD|100&101\tF|1', | ||
en: 'B|10&11_C|18&99_D|100&101_F|1', | ||
es: 'F|1', | ||
@@ -248,16 +248,16 @@ et: 'F|1', | ||
fi: 'F|1', | ||
fil: 'B|0\tF|1', | ||
fr: 'B|0\tF|1', | ||
fil: 'B|0_F|1', | ||
fr: 'B|0_F|1', | ||
fy: 'F|1', | ||
ga: 'B|0\tF|1', | ||
gd: 'B|49\tC|50\tD|102\tF|1', | ||
ga: 'B|0_F|1', | ||
gd: 'B|49_C|50_D|102_F|1', | ||
gl: 'F|1', | ||
gsw: 'F|1', | ||
gu: 'B|0\tC|85\tD|86\tE|38\tF|1', | ||
gu: 'B|0_C|85_D|86_E|38_F|1', | ||
he: 'F|1', | ||
hi: 'B|0\tC|85\tD|86\tE|38\tF|1', | ||
hi: 'B|0_C|85_D|86_E|38_F|1', | ||
hr: 'F|1', | ||
hsb: 'F|1', | ||
hu: 'B|103\tF|1', | ||
hy: 'B|0\tF|1', | ||
hu: 'B|103_F|1', | ||
hy: 'B|0_F|1', | ||
ia: 'F|1', | ||
@@ -267,26 +267,26 @@ id: 'F|1', | ||
is: 'F|1', | ||
it: 'E|104\tF|1', | ||
it: 'E|104_F|1', | ||
iw: 'F|1', | ||
ja: 'F|1', | ||
ka: 'B|8\tE|3|105\tF|1', | ||
kk: 'E|106|107|14&22\tF|1', | ||
ka: 'B|8_E|3|105_F|1', | ||
kk: 'E|106|107|14&22_F|1', | ||
km: 'F|1', | ||
kn: 'F|1', | ||
ko: 'F|1', | ||
kw: 'B|108|109\tE|110|111\tF|1', | ||
kw: 'B|108|109_E|110|111_F|1', | ||
ky: 'F|1', | ||
lo: 'B|0\tF|1', | ||
lo: 'B|0_F|1', | ||
lt: 'F|1', | ||
lv: 'F|1', | ||
mk: 'B|24&25\tC|52&112\tE|113&114\tF|1', | ||
mk: 'B|24&25_C|52&112_E|113&114_F|1', | ||
ml: 'F|1', | ||
mn: 'F|1', | ||
mo: 'B|0\tF|1', | ||
mr: 'B|0\tC|85\tD|86\tF|1', | ||
ms: 'B|0\tF|1', | ||
mo: 'B|0_F|1', | ||
mr: 'B|0_C|85_D|86_F|1', | ||
ms: 'B|0_F|1', | ||
my: 'F|1', | ||
nb: 'F|1', | ||
ne: 'B|108\tF|1', | ||
ne: 'B|108_F|1', | ||
nl: 'F|1', | ||
or: 'B|115\tC|85\tD|86\tE|38\tF|1', | ||
or: 'B|115_C|85_D|86_E|38_F|1', | ||
pa: 'F|1', | ||
@@ -297,7 +297,7 @@ pl: 'F|1', | ||
pt: 'F|1', | ||
ro: 'B|0\tF|1', | ||
ro: 'B|0_F|1', | ||
root: 'F|1', | ||
ru: 'F|1', | ||
sc: 'E|104\tF|1', | ||
scn: 'E|104\tF|1', | ||
sc: 'E|104_F|1', | ||
scn: 'E|104_F|1', | ||
sd: 'F|1', | ||
@@ -308,5 +308,5 @@ sh: 'F|1', | ||
sl: 'F|1', | ||
sq: 'B|0\tE|116&117\tF|1', | ||
sq: 'B|0_E|116&117_F|1', | ||
sr: 'F|1', | ||
sv: 'B|118&119\tF|1', | ||
sv: 'B|118&119_F|1', | ||
sw: 'F|1', | ||
@@ -316,9 +316,9 @@ ta: 'F|1', | ||
th: 'F|1', | ||
tk: 'D|120|121\tF|1', | ||
tl: 'B|0\tF|1', | ||
tk: 'D|120|121_F|1', | ||
tl: 'B|0_F|1', | ||
tr: 'F|1', | ||
uk: 'D|100&101\tF|1', | ||
uk: 'D|100&101_F|1', | ||
ur: 'F|1', | ||
uz: 'F|1', | ||
vi: 'B|0\tF|1', | ||
vi: 'B|0_F|1', | ||
yue: 'F|1', | ||
@@ -325,0 +325,0 @@ zh: 'F|1', |
@@ -0,2 +1,3 @@ | ||
export { NumberOperands } from './operands'; | ||
import { PluralRules } from './types'; | ||
export declare const pluralRules: PluralRules; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var autogen_rules_1 = require("./autogen.rules"); | ||
var operands_1 = require("./operands"); | ||
exports.NumberOperands = operands_1.NumberOperands; | ||
var types_1 = require("./types"); | ||
exports.pluralRules = new types_1.PluralRules(autogen_rules_1.expressions, autogen_rules_1.cardinalRules, autogen_rules_1.ordinalRules); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,3 @@ | ||
import { NumberOperands } from '@phensley/decimal'; | ||
import { Decimal } from '@phensley/decimal'; | ||
import { NumberOperands } from './operands'; | ||
export declare type RuleMap = { | ||
@@ -9,2 +10,10 @@ [x: string]: PluralRule; | ||
export declare type Operand = 'n' | 'i' | 'v' | 'w' | 'f' | 't'; | ||
export declare const enum Op { | ||
N = 0, | ||
I = 1, | ||
V = 2, | ||
W = 4, | ||
F = 8, | ||
T = 16 | ||
} | ||
export declare class RuleCache { | ||
@@ -26,4 +35,5 @@ private strings; | ||
constructor(expressionsRaw: string[], cardinalsRaw: StringMap, ordinalsRaw: StringMap); | ||
cardinal(language: string, operands: NumberOperands): string; | ||
ordinal(language: string, operands: NumberOperands): string; | ||
operands(d: Decimal): NumberOperands; | ||
cardinal(language: string, n: Decimal): string; | ||
ordinal(language: string, n: Decimal): string; | ||
private evaluate; | ||
@@ -55,6 +65,6 @@ private execute; | ||
readonly operator: string; | ||
readonly mod: number; | ||
readonly ranges: (number | number[])[]; | ||
readonly mod?: Decimal; | ||
readonly ranges: (Decimal | Decimal[])[]; | ||
constructor(raw: string); | ||
} | ||
export declare const evaluateExpr: (operands: NumberOperands, expr: PluralExpr) => boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var decimal_1 = require("@phensley/decimal"); | ||
var operands_1 = require("./operands"); | ||
// Notation for categories in compact plural rules | ||
@@ -43,8 +45,11 @@ var CATEGORIES = { | ||
} | ||
PluralRules.prototype.cardinal = function (language, operands) { | ||
return this.evaluate(language, operands, this.cardinals); | ||
PluralRules.prototype.operands = function (d) { | ||
return new operands_1.NumberOperands(d); | ||
}; | ||
PluralRules.prototype.ordinal = function (language, operands) { | ||
return this.evaluate(language, operands, this.ordinals); | ||
PluralRules.prototype.cardinal = function (language, n) { | ||
return this.evaluate(language, new operands_1.NumberOperands(n), this.cardinals); | ||
}; | ||
PluralRules.prototype.ordinal = function (language, n) { | ||
return this.evaluate(language, new operands_1.NumberOperands(n), this.ordinals); | ||
}; | ||
PluralRules.prototype.evaluate = function (language, operands, cache) { | ||
@@ -103,3 +108,3 @@ var rule = cache.get(language); | ||
function PluralRule(raw) { | ||
this.conditions = raw.split('\t').map(function (s) { return new PluralCond(s); }); | ||
this.conditions = raw.split('_').map(function (s) { return new PluralCond(s); }); | ||
} | ||
@@ -129,3 +134,3 @@ return PluralRule; | ||
this.operator = '='; | ||
this.mod = 0; | ||
var mod = 0; | ||
var i = 1; | ||
@@ -145,4 +150,4 @@ while (i < raw.length) { | ||
case '9': | ||
this.mod *= 10; | ||
this.mod += Number(ch); | ||
mod *= 10; | ||
mod += Number(ch); | ||
break; | ||
@@ -162,4 +167,8 @@ case '!': | ||
} | ||
this.ranges = raw.substring(i).split(',') | ||
.map(function (s) { return s.indexOf(':') === -1 ? Number(s) : s.split(':').map(Number); }); | ||
if (mod) { | ||
this.mod = new decimal_1.Decimal(mod); | ||
} | ||
raw = raw.substring(i); | ||
this.ranges = raw ? raw.split(',') | ||
.map(function (s) { return s.indexOf(':') === -1 ? new decimal_1.Decimal(s) : s.split(':').map(function (x) { return new decimal_1.Decimal(x); }); }) : []; | ||
} | ||
@@ -171,13 +180,10 @@ return PluralExpr; | ||
var operand = expr.operand, ranges = expr.ranges; | ||
if (!operand) { | ||
return false; | ||
} | ||
var n = operands[operand]; | ||
// If we're applying modulus to the 'n' operand we must also ensure | ||
// decimal value is zero. | ||
if (expr.operand === 'n') { | ||
if (operands.f !== 0) { | ||
return false; | ||
} | ||
if (expr.mod) { | ||
n = n.divmod(expr.mod)[1]; | ||
} | ||
if (expr.mod !== 0) { | ||
n = n % expr.mod; | ||
} | ||
var integer = n.isInteger(); | ||
var equals = expr.operator !== '!'; | ||
@@ -188,7 +194,7 @@ var len = ranges.length; | ||
var elem = ranges[i]; | ||
if (typeof elem === 'number') { | ||
res = res || n === elem; | ||
if (elem instanceof decimal_1.Decimal) { | ||
res = res || n.compare(elem) === 0; | ||
} | ||
else { | ||
res = res || (n >= elem[0] && n <= elem[1]); | ||
res = res || (integer && n.compare(elem[0]) >= 0 && n.compare(elem[1]) <= 0); | ||
} | ||
@@ -195,0 +201,0 @@ } |
{ | ||
"name": "@phensley/plurals", | ||
"version": "0.21.2", | ||
"version": "0.22.0", | ||
"description": "Plural rules engine", | ||
@@ -37,3 +37,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@phensley/decimal": "0.21.2", | ||
"@phensley/decimal": "0.22.0", | ||
"tslib": "1.10.x" | ||
@@ -67,3 +67,3 @@ }, | ||
}, | ||
"gitHead": "addab8991700dcf4be622cae7b8a3fd01f9d35bd" | ||
"gitHead": "84248f89037d075e80bc54c97f896767558ad1ca" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85924
27
1653
+ Added@phensley/decimal@0.22.0(transitive)
- Removed@phensley/decimal@0.21.2(transitive)
Updated@phensley/decimal@0.22.0