From e2aedcfb27c41ac8dacb3e09868b18eeb5d4bc57 Mon Sep 17 00:00:00 2001 From: Nick Snyder Date: Mon, 28 Sep 2020 20:48:49 -0700 Subject: [PATCH] Upgrade CLDR data to v37 (#227) --- .github/workflows/build.yml | 6 ++- dev.md | 8 --- v2/internal/plural/codegen/README.md | 6 +++ v2/internal/plural/codegen/plurals.xml | 28 +++++----- v2/internal/plural/rule_gen.go | 52 +++++++++--------- v2/internal/plural/rule_gen_test.go | 74 +++++++++++++------------- 6 files changed, 87 insertions(+), 87 deletions(-) delete mode 100644 dev.md create mode 100644 v2/internal/plural/codegen/README.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e5b2b860..55d94601 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,8 +4,9 @@ on: - pull_request jobs: build: - runs-on: ubuntu-latest name: Build + runs-on: ubuntu-latest + if: (github.event_name == 'push' && github.repository_owner == 'nicksnyder') || (github.event_name == 'pull_request' && github.repository_owner != 'nicksnyder') steps: - name: Install Go uses: actions/setup-go@v2 @@ -25,8 +26,9 @@ jobs: - name: Upload coverage uses: codecov/codecov-action@v1 build_1_9_7: - runs-on: ubuntu-latest name: Build with Go 1.9.7 + runs-on: ubuntu-latest + if: (github.event_name == 'push' && github.repository_owner == 'nicksnyder') || (github.event_name == 'pull_request' && github.repository_owner != 'nicksnyder') steps: - name: Install Go uses: actions/setup-go@v2 diff --git a/dev.md b/dev.md deleted file mode 100644 index f21dd611..00000000 --- a/dev.md +++ /dev/null @@ -1,8 +0,0 @@ -# Development notes - -## How to upgrade CLDR data - -1. Go to http://cldr.unicode.org/index/downloads to find the latest version. -1. Download the latest version of cldr-common (e.g. http://unicode.org/Public/cldr/33/cldr-common-33.0.zip) -1. Unzip and copy `v2/common/supplemental/plurals.xml` to `v2/i18n/internal/plural/codegen/plurals.xml` -1. Run `generate.sh` in `v2/i18n/internal/plural/codegen/` diff --git a/v2/internal/plural/codegen/README.md b/v2/internal/plural/codegen/README.md new file mode 100644 index 00000000..41a0094d --- /dev/null +++ b/v2/internal/plural/codegen/README.md @@ -0,0 +1,6 @@ +# How to upgrade CLDR data + +1. Go to http://cldr.unicode.org/index/downloads to find the latest version. +1. Download the latest version of cldr-common (e.g. http://unicode.org/Public/cldr/37/cldr-common-37.0.zip) +1. Unzip and copy `common/supplemental/plurals.xml` to this directory. +1. Run `generate.sh`. diff --git a/v2/internal/plural/codegen/plurals.xml b/v2/internal/plural/codegen/plurals.xml index 9bd3e70a..606c8744 100644 --- a/v2/internal/plural/codegen/plurals.xml +++ b/v2/internal/plural/codegen/plurals.xml @@ -6,19 +6,19 @@ CLDR data files are interpreted according to the LDML specification (http://unic For terms of use, see http://www.unicode.org/copyright.html --> - + - + @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, … - + i = 0 or n = 1 @integer 0, 1 @decimal 0.0~1.0, 0.00~0.04 @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, … @@ -38,7 +38,7 @@ For terms of use, see http://www.unicode.org/copyright.html 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 @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, … - + n = 0..1 @integer 0, 1 @decimal 0.0, 1.0, 0.00, 1.00, 0.000, 1.000, 0.0000, 1.0000 @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, … @@ -46,7 +46,7 @@ For terms of use, see http://www.unicode.org/copyright.html 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 @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, … - + n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000 @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, … @@ -87,7 +87,7 @@ For terms of use, see http://www.unicode.org/copyright.html - + n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000 n = 2 @integer 2 @decimal 2.0, 2.00, 2.000, 2.0000 @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, … @@ -206,6 +206,14 @@ For terms of use, see http://www.unicode.org/copyright.html + + n = 0 @integer 0 @decimal 0.0, 0.00, 0.000, 0.0000 + n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000 + 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, … + 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, … + 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, … + @integer 4~19, 100, 1004, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.0, 100.0, 1000.1, 1000000.0, … + n = 0 @integer 0 @decimal 0.0, 0.00, 0.000, 0.0000 n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000 @@ -222,13 +230,5 @@ For terms of use, see http://www.unicode.org/copyright.html n = 6 @integer 6 @decimal 6.0, 6.00, 6.000, 6.0000 @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, … - - n = 0 @integer 0 @decimal 0.0, 0.00, 0.000, 0.0000 - n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000 - 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, … - 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, … - 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, … - @integer 4~19, 100, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.0, 100.0, 1000000.0, … - diff --git a/v2/internal/plural/rule_gen.go b/v2/internal/plural/rule_gen.go index b089925c..9a32ca48 100644 --- a/v2/internal/plural/rule_gen.go +++ b/v2/internal/plural/rule_gen.go @@ -6,13 +6,13 @@ package plural func DefaultRules() Rules { rules := Rules{} - 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{ + 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{ PluralForms: newPluralFormSet(Other), PluralFormFunc: func(ops *Operands) Form { return Other }, }) - addPluralRules(rules, []string{"am", "as", "bn", "fa", "gu", "hi", "kn", "zu"}, &Rule{ + addPluralRules(rules, []string{"am", "as", "bn", "fa", "gu", "hi", "kn", "pcm", "zu"}, &Rule{ PluralForms: newPluralFormSet(One, Other), PluralFormFunc: func(ops *Operands) Form { // i = 0 or n = 1 @@ -64,7 +64,7 @@ func DefaultRules() Rules { return Other }, }) - addPluralRules(rules, []string{"ak", "bh", "guw", "ln", "mg", "nso", "pa", "ti", "wa"}, &Rule{ + addPluralRules(rules, []string{"ak", "bho", "guw", "ln", "mg", "nso", "pa", "ti", "wa"}, &Rule{ PluralForms: newPluralFormSet(One, Other), PluralFormFunc: func(ops *Operands) Form { // n = 0..1 @@ -85,7 +85,7 @@ func DefaultRules() Rules { return Other }, }) - 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{ + 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{ PluralForms: newPluralFormSet(One, Other), PluralFormFunc: func(ops *Operands) Form { // n = 1 @@ -186,7 +186,7 @@ func DefaultRules() Rules { return Other }, }) - addPluralRules(rules, []string{"iu", "naq", "se", "sma", "smi", "smj", "smn", "sms"}, &Rule{ + addPluralRules(rules, []string{"iu", "naq", "sat", "se", "sma", "smi", "smj", "smn", "sms"}, &Rule{ PluralForms: newPluralFormSet(One, Two, Other), PluralFormFunc: func(ops *Operands) Form { // n = 1 @@ -504,7 +504,7 @@ func DefaultRules() Rules { return Other }, }) - addPluralRules(rules, []string{"ar", "ars"}, &Rule{ + addPluralRules(rules, []string{"kw"}, &Rule{ PluralForms: newPluralFormSet(Zero, One, Two, Few, Many, Other), PluralFormFunc: func(ops *Operands) Form { // n = 0 @@ -515,22 +515,24 @@ func DefaultRules() Rules { if ops.NEqualsAny(1) { return One } - // n = 2 - if ops.NEqualsAny(2) { + // 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 + if ops.NModEqualsAny(100, 2, 22, 42, 62, 82) || + ops.NModEqualsAny(1000, 0) && (ops.NModInRange(100000, 1000, 20000) || ops.NModEqualsAny(100000, 40000, 60000, 80000)) || + !ops.NEqualsAny(0) && ops.NModEqualsAny(1000000, 100000) { return Two } - // n % 100 = 3..10 - if ops.NModInRange(100, 3, 10) { + // n % 100 = 3,23,43,63,83 + if ops.NModEqualsAny(100, 3, 23, 43, 63, 83) { return Few } - // n % 100 = 11..99 - if ops.NModInRange(100, 11, 99) { + // n != 1 and n % 100 = 1,21,41,61,81 + if !ops.NEqualsAny(1) && ops.NModEqualsAny(100, 1, 21, 41, 61, 81) { return Many } return Other }, }) - addPluralRules(rules, []string{"cy"}, &Rule{ + addPluralRules(rules, []string{"ar", "ars"}, &Rule{ PluralForms: newPluralFormSet(Zero, One, Two, Few, Many, Other), PluralFormFunc: func(ops *Operands) Form { // n = 0 @@ -545,18 +547,18 @@ func DefaultRules() Rules { if ops.NEqualsAny(2) { return Two } - // n = 3 - if ops.NEqualsAny(3) { + // n % 100 = 3..10 + if ops.NModInRange(100, 3, 10) { return Few } - // n = 6 - if ops.NEqualsAny(6) { + // n % 100 = 11..99 + if ops.NModInRange(100, 11, 99) { return Many } return Other }, }) - addPluralRules(rules, []string{"kw"}, &Rule{ + addPluralRules(rules, []string{"cy"}, &Rule{ PluralForms: newPluralFormSet(Zero, One, Two, Few, Many, Other), PluralFormFunc: func(ops *Operands) Form { // n = 0 @@ -567,18 +569,16 @@ func DefaultRules() Rules { if ops.NEqualsAny(1) { return One } - // 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 - if ops.NModEqualsAny(100, 2, 22, 42, 62, 82) || - ops.NModEqualsAny(1000, 0) && (ops.NModInRange(100000, 1000, 20000) || ops.NModEqualsAny(100000, 40000, 60000, 80000)) || - !ops.NEqualsAny(0) && ops.NModEqualsAny(1000000, 100000) { + // n = 2 + if ops.NEqualsAny(2) { return Two } - // n % 100 = 3,23,43,63,83 - if ops.NModEqualsAny(100, 3, 23, 43, 63, 83) { + // n = 3 + if ops.NEqualsAny(3) { return Few } - // n != 1 and n % 100 = 1,21,41,61,81 - if !ops.NEqualsAny(1) && ops.NModEqualsAny(100, 1, 21, 41, 61, 81) { + // n = 6 + if ops.NEqualsAny(6) { return Many } return Other diff --git a/v2/internal/plural/rule_gen_test.go b/v2/internal/plural/rule_gen_test.go index a17782c1..ca3dc595 100644 --- a/v2/internal/plural/rule_gen_test.go +++ b/v2/internal/plural/rule_gen_test.go @@ -4,19 +4,19 @@ package plural import "testing" -func TestBmBoDzIdIgIiInJaJboJvJwKdeKeaKmKoLktLoMsMyNqoRootSahSesSgThToViWoYoYueZh(t *testing.T) { +func TestBmBoDzIdIgIiInJaJboJvJwKdeKeaKmKoLktLoMsMyNqoOsaRootSahSesSgSuThToViWoYoYueZh(t *testing.T) { var tests []pluralFormTest tests = appendIntegerTests(tests, Other, []string{"0~15", "100", "1000", "10000", "100000", "1000000"}) tests = appendDecimalTests(tests, Other, []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}) - locales := []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"} + locales := []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"} for _, locale := range locales { runTests(t, locale, tests) } } -func TestAmAsBnFaGuHiKnZu(t *testing.T) { +func TestAmAsBnFaGuHiKnPcmZu(t *testing.T) { var tests []pluralFormTest tests = appendIntegerTests(tests, One, []string{"0", "1"}) @@ -25,7 +25,7 @@ func TestAmAsBnFaGuHiKnZu(t *testing.T) { tests = appendIntegerTests(tests, Other, []string{"2~17", "100", "1000", "10000", "100000", "1000000"}) tests = appendDecimalTests(tests, Other, []string{"1.1~2.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}) - locales := []string{"am", "as", "bn", "fa", "gu", "hi", "kn", "zu"} + locales := []string{"am", "as", "bn", "fa", "gu", "hi", "kn", "pcm", "zu"} for _, locale := range locales { runTests(t, locale, tests) } @@ -90,7 +90,7 @@ func TestSi(t *testing.T) { } } -func TestAkBhGuwLnMgNsoPaTiWa(t *testing.T) { +func TestAkBhoGuwLnMgNsoPaTiWa(t *testing.T) { var tests []pluralFormTest tests = appendIntegerTests(tests, One, []string{"0", "1"}) @@ -99,7 +99,7 @@ func TestAkBhGuwLnMgNsoPaTiWa(t *testing.T) { tests = appendIntegerTests(tests, Other, []string{"2~17", "100", "1000", "10000", "100000", "1000000"}) tests = appendDecimalTests(tests, Other, []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}) - locales := []string{"ak", "bh", "guw", "ln", "mg", "nso", "pa", "ti", "wa"} + locales := []string{"ak", "bho", "guw", "ln", "mg", "nso", "pa", "ti", "wa"} for _, locale := range locales { runTests(t, locale, tests) } @@ -120,7 +120,7 @@ func TestTzm(t *testing.T) { } } -func TestAfAsaAzBemBezBgBrxCeCggChrCkbDvEeElEoEsEuFoFurGswHaHawHuJgoJmcKaKajKcgKkKkjKlKsKsbKuKyLbLgMasMgoMlMnMrNahNbNdNeNnNnhNoNrNyNynOmOrOsPapPsRmRofRwkSaqSdSdhSehSnSoSqSsSsyStSyrTaTeTeoTigTkTnTrTsUgUzVeVoVunWaeXhXog(t *testing.T) { +func TestAfAnAsaAzBemBezBgBrxCeCggChrCkbDvEeElEoEsEuFoFurGswHaHawHuJgoJmcKaKajKcgKkKkjKlKsKsbKuKyLbLgMasMgoMlMnMrNahNbNdNeNnNnhNoNrNyNynOmOrOsPapPsRmRofRwkSaqSdSdhSehSnSoSqSsSsyStSyrTaTeTeoTigTkTnTrTsUgUzVeVoVunWaeXhXog(t *testing.T) { var tests []pluralFormTest tests = appendIntegerTests(tests, One, []string{"1"}) @@ -129,7 +129,7 @@ func TestAfAsaAzBemBezBgBrxCeCggChrCkbDvEeElEoEsEuFoFurGswHaHawHuJgoJmcKaKajKcgK tests = appendIntegerTests(tests, Other, []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}) tests = appendDecimalTests(tests, Other, []string{"0.0~0.9", "1.1~1.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}) - locales := []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"} + locales := []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"} for _, locale := range locales { runTests(t, locale, tests) } @@ -249,7 +249,7 @@ func TestKsh(t *testing.T) { } } -func TestIuNaqSeSmaSmiSmjSmnSms(t *testing.T) { +func TestIuNaqSatSeSmaSmiSmjSmnSms(t *testing.T) { var tests []pluralFormTest tests = appendIntegerTests(tests, One, []string{"1"}) @@ -261,7 +261,7 @@ func TestIuNaqSeSmaSmiSmjSmnSms(t *testing.T) { tests = appendIntegerTests(tests, Other, []string{"0", "3~17", "100", "1000", "10000", "100000", "1000000"}) tests = appendDecimalTests(tests, Other, []string{"0.0~0.9", "1.1~1.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}) - locales := []string{"iu", "naq", "se", "sma", "smi", "smj", "smn", "sms"} + locales := []string{"iu", "naq", "sat", "se", "sma", "smi", "smj", "smn", "sms"} for _, locale := range locales { runTests(t, locale, tests) } @@ -576,6 +576,33 @@ func TestGv(t *testing.T) { } } +func TestKw(t *testing.T) { + var tests []pluralFormTest + + tests = appendIntegerTests(tests, Zero, []string{"0"}) + tests = appendDecimalTests(tests, Zero, []string{"0.0", "0.00", "0.000", "0.0000"}) + + tests = appendIntegerTests(tests, One, []string{"1"}) + tests = appendDecimalTests(tests, One, []string{"1.0", "1.00", "1.000", "1.0000"}) + + tests = appendIntegerTests(tests, Two, []string{"2", "22", "42", "62", "82", "102", "122", "142", "1000", "10000", "100000"}) + tests = appendDecimalTests(tests, Two, []string{"2.0", "22.0", "42.0", "62.0", "82.0", "102.0", "122.0", "142.0", "1000.0", "10000.0", "100000.0"}) + + tests = appendIntegerTests(tests, Few, []string{"3", "23", "43", "63", "83", "103", "123", "143", "1003"}) + tests = appendDecimalTests(tests, Few, []string{"3.0", "23.0", "43.0", "63.0", "83.0", "103.0", "123.0", "143.0", "1003.0"}) + + tests = appendIntegerTests(tests, Many, []string{"21", "41", "61", "81", "101", "121", "141", "161", "1001"}) + tests = appendDecimalTests(tests, Many, []string{"21.0", "41.0", "61.0", "81.0", "101.0", "121.0", "141.0", "161.0", "1001.0"}) + + tests = appendIntegerTests(tests, Other, []string{"4~19", "100", "1004", "1000000"}) + tests = appendDecimalTests(tests, Other, []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.1", "1000000.0"}) + + locales := []string{"kw"} + for _, locale := range locales { + runTests(t, locale, tests) + } +} + func TestArArs(t *testing.T) { var tests []pluralFormTest @@ -629,30 +656,3 @@ func TestCy(t *testing.T) { runTests(t, locale, tests) } } - -func TestKw(t *testing.T) { - var tests []pluralFormTest - - tests = appendIntegerTests(tests, Zero, []string{"0"}) - tests = appendDecimalTests(tests, Zero, []string{"0.0", "0.00", "0.000", "0.0000"}) - - tests = appendIntegerTests(tests, One, []string{"1"}) - tests = appendDecimalTests(tests, One, []string{"1.0", "1.00", "1.000", "1.0000"}) - - tests = appendIntegerTests(tests, Two, []string{"2", "22", "42", "62", "82", "102", "122", "142", "1002"}) - tests = appendDecimalTests(tests, Two, []string{"2.0", "22.0", "42.0", "62.0", "82.0", "102.0", "122.0", "142.0", "1002.0"}) - - tests = appendIntegerTests(tests, Few, []string{"3", "23", "43", "63", "83", "103", "123", "143", "1003"}) - tests = appendDecimalTests(tests, Few, []string{"3.0", "23.0", "43.0", "63.0", "83.0", "103.0", "123.0", "143.0", "1003.0"}) - - tests = appendIntegerTests(tests, Many, []string{"21", "41", "61", "81", "101", "121", "141", "161", "1001"}) - tests = appendDecimalTests(tests, Many, []string{"21.0", "41.0", "61.0", "81.0", "101.0", "121.0", "141.0", "161.0", "1001.0"}) - - tests = appendIntegerTests(tests, Other, []string{"4~19", "100", "1000000"}) - tests = appendDecimalTests(tests, Other, []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000000.0"}) - - locales := []string{"kw"} - for _, locale := range locales { - runTests(t, locale, tests) - } -}