@@ -6,13 +6,13 @@ package plural
66func DefaultRules () Rules {
77 rules := Rules {}
88
9- addPluralRules (rules , []string {"bm" , "bo" , "dz" , "id" , "ig" , "ii" , "in" , "ja" , "jbo" , "jv" , "jw" , "kde" , "kea" , "km" , "ko" , "lkt" , "lo" , "ms" , "my" , "nqo" , "root" , "sah" , "ses" , "sg" , "th" , "to" , "vi" , "wo" , "yo" , "yue" , "zh" }, & Rule {
9+ addPluralRules (rules , []string {"bm" , "bo" , "dz" , "id" , "ig" , "ii" , "in" , "ja" , "jbo" , "jv" , "jw" , "kde" , "kea" , "km" , "ko" , "lkt" , "lo" , "ms" , "my" , "nqo" , "osa" , " root" , "sah" , "ses" , "sg" , "su " , "th" , "to" , "vi" , "wo" , "yo" , "yue" , "zh" }, & Rule {
1010 PluralForms : newPluralFormSet (Other ),
1111 PluralFormFunc : func (ops * Operands ) Form {
1212 return Other
1313 },
1414 })
15- addPluralRules (rules , []string {"am" , "as" , "bn" , "fa" , "gu" , "hi" , "kn" , "zu" }, & Rule {
15+ addPluralRules (rules , []string {"am" , "as" , "bn" , "fa" , "gu" , "hi" , "kn" , "pcm" , " zu" }, & Rule {
1616 PluralForms : newPluralFormSet (One , Other ),
1717 PluralFormFunc : func (ops * Operands ) Form {
1818 // i = 0 or n = 1
@@ -64,7 +64,7 @@ func DefaultRules() Rules {
6464 return Other
6565 },
6666 })
67- addPluralRules (rules , []string {"ak" , "bh " , "guw" , "ln" , "mg" , "nso" , "pa" , "ti" , "wa" }, & Rule {
67+ addPluralRules (rules , []string {"ak" , "bho " , "guw" , "ln" , "mg" , "nso" , "pa" , "ti" , "wa" }, & Rule {
6868 PluralForms : newPluralFormSet (One , Other ),
6969 PluralFormFunc : func (ops * Operands ) Form {
7070 // n = 0..1
@@ -85,7 +85,7 @@ func DefaultRules() Rules {
8585 return Other
8686 },
8787 })
88- addPluralRules (rules , []string {"af" , "asa" , "az" , "bem" , "bez" , "bg" , "brx" , "ce" , "cgg" , "chr" , "ckb" , "dv" , "ee" , "el" , "eo" , "es" , "eu" , "fo" , "fur" , "gsw" , "ha" , "haw" , "hu" , "jgo" , "jmc" , "ka" , "kaj" , "kcg" , "kk" , "kkj" , "kl" , "ks" , "ksb" , "ku" , "ky" , "lb" , "lg" , "mas" , "mgo" , "ml" , "mn" , "mr" , "nah" , "nb" , "nd" , "ne" , "nn" , "nnh" , "no" , "nr" , "ny" , "nyn" , "om" , "or" , "os" , "pap" , "ps" , "rm" , "rof" , "rwk" , "saq" , "sd" , "sdh" , "seh" , "sn" , "so" , "sq" , "ss" , "ssy" , "st" , "syr" , "ta" , "te" , "teo" , "tig" , "tk" , "tn" , "tr" , "ts" , "ug" , "uz" , "ve" , "vo" , "vun" , "wae" , "xh" , "xog" }, & Rule {
88+ addPluralRules (rules , []string {"af" , "an" , " asa" , "az" , "bem" , "bez" , "bg" , "brx" , "ce" , "cgg" , "chr" , "ckb" , "dv" , "ee" , "el" , "eo" , "es" , "eu" , "fo" , "fur" , "gsw" , "ha" , "haw" , "hu" , "jgo" , "jmc" , "ka" , "kaj" , "kcg" , "kk" , "kkj" , "kl" , "ks" , "ksb" , "ku" , "ky" , "lb" , "lg" , "mas" , "mgo" , "ml" , "mn" , "mr" , "nah" , "nb" , "nd" , "ne" , "nn" , "nnh" , "no" , "nr" , "ny" , "nyn" , "om" , "or" , "os" , "pap" , "ps" , "rm" , "rof" , "rwk" , "saq" , "sd" , "sdh" , "seh" , "sn" , "so" , "sq" , "ss" , "ssy" , "st" , "syr" , "ta" , "te" , "teo" , "tig" , "tk" , "tn" , "tr" , "ts" , "ug" , "uz" , "ve" , "vo" , "vun" , "wae" , "xh" , "xog" }, & Rule {
8989 PluralForms : newPluralFormSet (One , Other ),
9090 PluralFormFunc : func (ops * Operands ) Form {
9191 // n = 1
@@ -186,7 +186,7 @@ func DefaultRules() Rules {
186186 return Other
187187 },
188188 })
189- addPluralRules (rules , []string {"iu" , "naq" , "se" , "sma" , "smi" , "smj" , "smn" , "sms" }, & Rule {
189+ addPluralRules (rules , []string {"iu" , "naq" , "sat" , " se" , "sma" , "smi" , "smj" , "smn" , "sms" }, & Rule {
190190 PluralForms : newPluralFormSet (One , Two , Other ),
191191 PluralFormFunc : func (ops * Operands ) Form {
192192 // n = 1
@@ -504,7 +504,7 @@ func DefaultRules() Rules {
504504 return Other
505505 },
506506 })
507- addPluralRules (rules , []string {"ar" , "ars " }, & Rule {
507+ addPluralRules (rules , []string {"kw " }, & Rule {
508508 PluralForms : newPluralFormSet (Zero , One , Two , Few , Many , Other ),
509509 PluralFormFunc : func (ops * Operands ) Form {
510510 // n = 0
@@ -515,22 +515,24 @@ func DefaultRules() Rules {
515515 if ops .NEqualsAny (1 ) {
516516 return One
517517 }
518- // n = 2
519- if ops .NEqualsAny (2 ) {
518+ // n % 100 = 2,22,42,62,82 or n % 1000 = 0 and n % 100000 = 1000..20000,40000,60000,80000 or n != 0 and n % 1000000 = 100000
519+ if ops .NModEqualsAny (100 , 2 , 22 , 42 , 62 , 82 ) ||
520+ ops .NModEqualsAny (1000 , 0 ) && (ops .NModInRange (100000 , 1000 , 20000 ) || ops .NModEqualsAny (100000 , 40000 , 60000 , 80000 )) ||
521+ ! ops .NEqualsAny (0 ) && ops .NModEqualsAny (1000000 , 100000 ) {
520522 return Two
521523 }
522- // n % 100 = 3..10
523- if ops .NModInRange (100 , 3 , 10 ) {
524+ // n % 100 = 3,23,43,63,83
525+ if ops .NModEqualsAny (100 , 3 , 23 , 43 , 63 , 83 ) {
524526 return Few
525527 }
526- // n % 100 = 11..99
527- if ops .NModInRange ( 100 , 11 , 99 ) {
528+ // n != 1 and n % 100 = 1,21,41,61,81
529+ if ! ops .NEqualsAny ( 1 ) && ops . NModEqualsAny ( 100 , 1 , 21 , 41 , 61 , 81 ) {
528530 return Many
529531 }
530532 return Other
531533 },
532534 })
533- addPluralRules (rules , []string {"cy " }, & Rule {
535+ addPluralRules (rules , []string {"ar" , "ars " }, & Rule {
534536 PluralForms : newPluralFormSet (Zero , One , Two , Few , Many , Other ),
535537 PluralFormFunc : func (ops * Operands ) Form {
536538 // n = 0
@@ -545,18 +547,18 @@ func DefaultRules() Rules {
545547 if ops .NEqualsAny (2 ) {
546548 return Two
547549 }
548- // n = 3
549- if ops .NEqualsAny ( 3 ) {
550+ // n % 100 = 3..10
551+ if ops .NModInRange ( 100 , 3 , 10 ) {
550552 return Few
551553 }
552- // n = 6
553- if ops .NEqualsAny ( 6 ) {
554+ // n % 100 = 11..99
555+ if ops .NModInRange ( 100 , 11 , 99 ) {
554556 return Many
555557 }
556558 return Other
557559 },
558560 })
559- addPluralRules (rules , []string {"kw " }, & Rule {
561+ addPluralRules (rules , []string {"cy " }, & Rule {
560562 PluralForms : newPluralFormSet (Zero , One , Two , Few , Many , Other ),
561563 PluralFormFunc : func (ops * Operands ) Form {
562564 // n = 0
@@ -567,18 +569,16 @@ func DefaultRules() Rules {
567569 if ops .NEqualsAny (1 ) {
568570 return One
569571 }
570- // n % 100 = 2,22,42,62,82 or n%1000 = 0 and n%100000=1000..20000,40000,60000,80000 or n!=0 and n%1000000=100000
571- if ops .NModEqualsAny (100 , 2 , 22 , 42 , 62 , 82 ) ||
572- ops .NModEqualsAny (1000 , 0 ) && (ops .NModInRange (100000 , 1000 , 20000 ) || ops .NModEqualsAny (100000 , 40000 , 60000 , 80000 )) ||
573- ! ops .NEqualsAny (0 ) && ops .NModEqualsAny (1000000 , 100000 ) {
572+ // n = 2
573+ if ops .NEqualsAny (2 ) {
574574 return Two
575575 }
576- // n % 100 = 3,23,43,63,83
577- if ops .NModEqualsAny ( 100 , 3 , 23 , 43 , 63 , 83 ) {
576+ // n = 3
577+ if ops .NEqualsAny ( 3 ) {
578578 return Few
579579 }
580- // n != 1 and n % 100 = 1,21,41,61,81
581- if ! ops .NEqualsAny (1 ) && ops . NModEqualsAny ( 100 , 1 , 21 , 41 , 61 , 81 ) {
580+ // n = 6
581+ if ops .NEqualsAny (6 ) {
582582 return Many
583583 }
584584 return Other
0 commit comments