Skip to content

Commit e2aedcf

Browse files
authored
Upgrade CLDR data to v37 (nicksnyder#227)
1 parent cba41a4 commit e2aedcf

File tree

6 files changed

+87
-87
lines changed

6 files changed

+87
-87
lines changed

‎.github/workflows/build.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ on:
44
- pull_request
55
jobs:
66
build:
7-
runs-on: ubuntu-latest
87
name: Build
8+
runs-on: ubuntu-latest
9+
if: (github.event_name == 'push' && github.repository_owner == 'nicksnyder') || (github.event_name == 'pull_request' && github.repository_owner != 'nicksnyder')
910
steps:
1011
- name: Install Go
1112
uses: actions/setup-go@v2
@@ -25,8 +26,9 @@ jobs:
2526
- name: Upload coverage
2627
uses: codecov/codecov-action@v1
2728
build_1_9_7:
28-
runs-on: ubuntu-latest
2929
name: Build with Go 1.9.7
30+
runs-on: ubuntu-latest
31+
if: (github.event_name == 'push' && github.repository_owner == 'nicksnyder') || (github.event_name == 'pull_request' && github.repository_owner != 'nicksnyder')
3032
steps:
3133
- name: Install Go
3234
uses: actions/setup-go@v2

‎dev.md‎

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# How to upgrade CLDR data
2+
3+
1. Go to http://cldr.unicode.org/index/downloads to find the latest version.
4+
1. Download the latest version of cldr-common (e.g. http://unicode.org/Public/cldr/37/cldr-common-37.0.zip)
5+
1. Unzip and copy `common/supplemental/plurals.xml` to this directory.
6+
1. Run `generate.sh`.

‎v2/internal/plural/codegen/plurals.xml‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ CLDR data files are interpreted according to the LDML specification (http://unic
66
For terms of use, see http://www.unicode.org/copyright.html
77
-->
88
<supplementalData>
9-
<version number="$Revision: 14885 $"/>
9+
<version number="$Revision$"/>
1010
<plurals type="cardinal">
1111
<!-- For a canonicalized list, use GeneratedPluralSamples -->
1212

1313
<!-- 1: other -->
1414

15-
<pluralRules locales="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">
15+
<pluralRules locales="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">
1616
<pluralRule count="other"> @integer 0~15, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
1717
</pluralRules>
1818

1919
<!-- 2: one,other -->
2020

21-
<pluralRules locales="am as bn fa gu hi kn zu">
21+
<pluralRules locales="am as bn fa gu hi kn pcm zu">
2222
<pluralRule count="one">i = 0 or n = 1 @integer 0, 1 @decimal 0.0~1.0, 0.00~0.04</pluralRule>
2323
<pluralRule count="other"> @integer 2~17, 100, 1000, 10000, 100000, 1000000, … @decimal 1.1~2.6, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
2424
</pluralRules>
@@ -38,15 +38,15 @@ For terms of use, see http://www.unicode.org/copyright.html
3838
<pluralRule count="one">n = 0,1 or i = 0 and f = 1 @integer 0, 1 @decimal 0.0, 0.1, 1.0, 0.00, 0.01, 1.00, 0.000, 0.001, 1.000, 0.0000, 0.0001, 1.0000</pluralRule>
3939
<pluralRule count="other"> @integer 2~17, 100, 1000, 10000, 100000, 1000000, … @decimal 0.2~0.9, 1.1~1.8, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
4040
</pluralRules>
41-
<pluralRules locales="ak bh guw ln mg nso pa ti wa">
41+
<pluralRules locales="ak bho guw ln mg nso pa ti wa">
4242
<pluralRule count="one">n = 0..1 @integer 0, 1 @decimal 0.0, 1.0, 0.00, 1.00, 0.000, 1.000, 0.0000, 1.0000</pluralRule>
4343
<pluralRule count="other"> @integer 2~17, 100, 1000, 10000, 100000, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
4444
</pluralRules>
4545
<pluralRules locales="tzm">
4646
<pluralRule count="one">n = 0..1 or n = 11..99 @integer 0, 1, 11~24 @decimal 0.0, 1.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0</pluralRule>
4747
<pluralRule count="other"> @integer 2~10, 100~106, 1000, 10000, 100000, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
4848
</pluralRules>
49-
<pluralRules locales="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">
49+
<pluralRules locales="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">
5050
<pluralRule count="one">n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000</pluralRule>
5151
<pluralRule count="other"> @integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~0.9, 1.1~1.6, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
5252
</pluralRules>
@@ -87,7 +87,7 @@ For terms of use, see http://www.unicode.org/copyright.html
8787

8888
<!-- 3: one,two,other -->
8989

90-
<pluralRules locales="iu naq se sma smi smj smn sms">
90+
<pluralRules locales="iu naq sat se sma smi smj smn sms">
9191
<pluralRule count="one">n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000</pluralRule>
9292
<pluralRule count="two">n = 2 @integer 2 @decimal 2.0, 2.00, 2.000, 2.0000</pluralRule>
9393
<pluralRule count="other"> @integer 0, 3~17, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~0.9, 1.1~1.6, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
@@ -206,6 +206,14 @@ For terms of use, see http://www.unicode.org/copyright.html
206206

207207
<!-- 6: zero,one,two,few,many,other -->
208208

209+
<pluralRules locales="kw">
210+
<pluralRule count="zero">n = 0 @integer 0 @decimal 0.0, 0.00, 0.000, 0.0000</pluralRule>
211+
<pluralRule count="one">n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000</pluralRule>
212+
<pluralRule count="two">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 @integer 2, 22, 42, 62, 82, 102, 122, 142, 1000, 10000, 100000, … @decimal 2.0, 22.0, 42.0, 62.0, 82.0, 102.0, 122.0, 142.0, 1000.0, 10000.0, 100000.0, …</pluralRule>
213+
<pluralRule count="few">n % 100 = 3,23,43,63,83 @integer 3, 23, 43, 63, 83, 103, 123, 143, 1003, … @decimal 3.0, 23.0, 43.0, 63.0, 83.0, 103.0, 123.0, 143.0, 1003.0, …</pluralRule>
214+
<pluralRule count="many">n != 1 and n % 100 = 1,21,41,61,81 @integer 21, 41, 61, 81, 101, 121, 141, 161, 1001, … @decimal 21.0, 41.0, 61.0, 81.0, 101.0, 121.0, 141.0, 161.0, 1001.0, …</pluralRule>
215+
<pluralRule count="other"> @integer 4~19, 100, 1004, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.0, 100.0, 1000.1, 1000000.0, …</pluralRule>
216+
</pluralRules>
209217
<pluralRules locales="ar ars">
210218
<pluralRule count="zero">n = 0 @integer 0 @decimal 0.0, 0.00, 0.000, 0.0000</pluralRule>
211219
<pluralRule count="one">n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000</pluralRule>
@@ -222,13 +230,5 @@ For terms of use, see http://www.unicode.org/copyright.html
222230
<pluralRule count="many">n = 6 @integer 6 @decimal 6.0, 6.00, 6.000, 6.0000</pluralRule>
223231
<pluralRule count="other"> @integer 4, 5, 7~20, 100, 1000, 10000, 100000, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
224232
</pluralRules>
225-
<pluralRules locales="kw">
226-
<pluralRule count="zero">n = 0 @integer 0 @decimal 0.0, 0.00, 0.000, 0.0000</pluralRule>
227-
<pluralRule count="one">n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000</pluralRule>
228-
<pluralRule count="two">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@integer 2, 22, 42, 62, 82, 102, 122, 142, 1002, … @decimal 2.0, 22.0, 42.0, 62.0, 82.0, 102.0, 122.0, 142.0, 1002.0, …</pluralRule>
229-
<pluralRule count="few">n % 100 = 3,23,43,63,83 @integer 3, 23, 43, 63, 83, 103, 123, 143, 1003, … @decimal 3.0, 23.0, 43.0, 63.0, 83.0, 103.0, 123.0, 143.0, 1003.0, …</pluralRule>
230-
<pluralRule count="many">n != 1 and n % 100 = 1,21,41,61,81 @integer 21, 41, 61, 81, 101, 121, 141, 161, 1001, … @decimal 21.0, 41.0, 61.0, 81.0, 101.0, 121.0, 141.0, 161.0, 1001.0, …</pluralRule>
231-
<pluralRule count="other"> @integer 4~19, 100, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.0, 100.0, 1000000.0, …</pluralRule>
232-
</pluralRules>
233233
</plurals>
234234
</supplementalData>

���v2/internal/plural/rule_gen.go‎

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ package plural
66
func 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

Comments
 (0)