Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions internal/plural/codegen/plurals.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE supplementalData SYSTEM "../../common/dtd/ldmlSupplemental.dtd">
<!--
Copyright © 1991-2022 Unicode, Inc.
Copyright © 1991-2024 Unicode, Inc.
For terms of use, see http://www.unicode.org/copyright.html
SPDX-License-Identifier: Unicode-DFS-2016
SPDX-License-Identifier: Unicode-3.0
CLDR data files are interpreted according to the LDML specification (http://unicode.org/reports/tr35/)
-->
<supplementalData>
Expand All @@ -27,15 +27,15 @@ CLDR data files are interpreted according to the LDML specification (http://unic
<pluralRule count="one">i = 0,1 @integer 0, 1 @decimal 0.0~1.5</pluralRule>
<pluralRule count="other"> @integer 2~17, 100, 1000, 10000, 100000, 1000000, … @decimal 2.0~3.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
</pluralRules>
<pluralRules locales="ast de en et fi fy gl ia io ji lij nl sc scn sv sw ur yi">
<pluralRules locales="ast de en et fi fy gl ia io ji lij nl sc sv sw ur yi">
<pluralRule count="one">i = 1 and v = 0 @integer 1</pluralRule>
<pluralRule count="other"> @integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
</pluralRules>
<pluralRules locales="si">
<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>
<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>
</pluralRules>
<pluralRules locales="ak bho guw ln mg nso pa ti wa">
<pluralRules locales="ak bho csw guw ln mg nso pa ti wa">
<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>
<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>
</pluralRules>
Expand Down Expand Up @@ -76,15 +76,15 @@ CLDR data files are interpreted according to the LDML specification (http://unic
<pluralRule count="one">i = 0,1 and n != 0 @integer 1 @decimal 0.1~1.6</pluralRule>
<pluralRule count="other"> @integer 2~17, 100, 1000, 10000, 100000, 1000000, … @decimal 2.0~3.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
</pluralRules>
<pluralRules locales="ksh">
<pluralRules locales="blo">
<pluralRule count="zero">n = 0 @integer 0 @decimal 0.0, 0.00, 0.000, 0.0000</pluralRule>
<pluralRule count="one">n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000</pluralRule>
<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>
</pluralRules>
<pluralRules locales="blo">
<pluralRules locales="ksh">
<pluralRule count="zero">n = 0 @integer 0 @decimal 0.0, 0.00, 0.000, 0.0000</pluralRule>
<pluralRule count="one">n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000</pluralRule>
<pluralRule count="other"> @integer 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 2.0~2.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
<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>
</pluralRules>

<!-- 3: one,two,other -->
Expand Down Expand Up @@ -130,7 +130,7 @@ CLDR data files are interpreted according to the LDML specification (http://unic
<pluralRule count="many">e = 0 and i != 0 and i % 1000000 = 0 and v = 0 or e != 0..5 @integer 1000000, 1c6, 2c6, 3c6, 4c6, 5c6, 6c6, … @decimal 1.0000001c6, 1.1c6, 2.0000001c6, 2.1c6, 3.0000001c6, 3.1c6, …</pluralRule>
<pluralRule count="other"> @integer 2~17, 100, 1000, 10000, 100000, 1c3, 2c3, 3c3, 4c3, 5c3, 6c3, … @decimal 2.0~3.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, 1.0001c3, 1.1c3, 2.0001c3, 2.1c3, 3.0001c3, 3.1c3, …</pluralRule>
</pluralRules>
<pluralRules locales="ca it pt_PT vec">
<pluralRules locales="ca it lld pt_PT scn vec">
<pluralRule count="one">i = 1 and v = 0 @integer 1</pluralRule>
<pluralRule count="many">e = 0 and i != 0 and i % 1000000 = 0 and v = 0 or e != 0..5 @integer 1000000, 1c6, 2c6, 3c6, 4c6, 5c6, 6c6, … @decimal 1.0000001c6, 1.1c6, 2.0000001c6, 2.1c6, 3.0000001c6, 3.1c6, …</pluralRule>
<pluralRule count="other"> @integer 0, 2~16, 100, 1000, 10000, 100000, 1c3, 2c3, 3c3, 4c3, 5c3, 6c3, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, 1.0001c3, 1.1c3, 2.0001c3, 2.1c3, 3.0001c3, 3.1c3, …</pluralRule>
Expand Down
10 changes: 5 additions & 5 deletions internal/plural/rule_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func DefaultRules() Rules {
return Other
},
})
addPluralRules(rules, []string{"ast", "de", "en", "et", "fi", "fy", "gl", "ia", "io", "ji", "lij", "nl", "sc", "scn", "sv", "sw", "ur", "yi"}, &Rule{
addPluralRules(rules, []string{"ast", "de", "en", "et", "fi", "fy", "gl", "ia", "io", "ji", "lij", "nl", "sc", "sv", "sw", "ur", "yi"}, &Rule{
PluralForms: newPluralFormSet(One, Other),
PluralFormFunc: func(ops *Operands) Form {
// i = 1 and v = 0
Expand All @@ -54,7 +54,7 @@ func DefaultRules() Rules {
return Other
},
})
addPluralRules(rules, []string{"ak", "bho", "guw", "ln", "mg", "nso", "pa", "ti", "wa"}, &Rule{
addPluralRules(rules, []string{"ak", "bho", "csw", "guw", "ln", "mg", "nso", "pa", "ti", "wa"}, &Rule{
PluralForms: newPluralFormSet(One, Other),
PluralFormFunc: func(ops *Operands) Form {
// n = 0..1
Expand Down Expand Up @@ -162,7 +162,7 @@ func DefaultRules() Rules {
return Other
},
})
addPluralRules(rules, []string{"ksh"}, &Rule{
addPluralRules(rules, []string{"blo"}, &Rule{
PluralForms: newPluralFormSet(Zero, One, Other),
PluralFormFunc: func(ops *Operands) Form {
// n = 0
Expand All @@ -176,7 +176,7 @@ func DefaultRules() Rules {
return Other
},
})
addPluralRules(rules, []string{"blo"}, &Rule{
addPluralRules(rules, []string{"ksh"}, &Rule{
PluralForms: newPluralFormSet(Zero, One, Other),
PluralFormFunc: func(ops *Operands) Form {
// n = 0
Expand Down Expand Up @@ -296,7 +296,7 @@ func DefaultRules() Rules {
return Other
},
})
addPluralRules(rules, []string{"ca", "it", "pt_PT", "vec"}, &Rule{
addPluralRules(rules, []string{"ca", "it", "lld", "pt_PT", "scn", "vec"}, &Rule{
PluralForms: newPluralFormSet(One, Many, Other),
PluralFormFunc: func(ops *Operands) Form {
// i = 1 and v = 0
Expand Down
24 changes: 12 additions & 12 deletions internal/plural/rule_gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ func TestFfHyKab(t *testing.T) {
}
}

func TestAstDeEnEtFiFyGlIaIoJiLijNlScScnSvSwUrYi(t *testing.T) {
func TestAstDeEnEtFiFyGlIaIoJiLijNlScSvSwUrYi(t *testing.T) {
var tests []pluralFormTest

tests = appendIntegerTests(tests, One, []string{"1"})

tests = appendIntegerTests(tests, Other, []string{"0", "2~16", "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{"ast", "de", "en", "et", "fi", "fy", "gl", "ia", "io", "ji", "lij", "nl", "sc", "scn", "sv", "sw", "ur", "yi"}
locales := []string{"ast", "de", "en", "et", "fi", "fy", "gl", "ia", "io", "ji", "lij", "nl", "sc", "sv", "sw", "ur", "yi"}
for _, locale := range locales {
runTests(t, locale, tests)
}
Expand All @@ -75,7 +75,7 @@ func TestSi(t *testing.T) {
}
}

func TestAkBhoGuwLnMgNsoPaTiWa(t *testing.T) {
func TestAkBhoCswGuwLnMgNsoPaTiWa(t *testing.T) {
var tests []pluralFormTest

tests = appendIntegerTests(tests, One, []string{"0", "1"})
Expand All @@ -84,7 +84,7 @@ func TestAkBhoGuwLnMgNsoPaTiWa(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", "bho", "guw", "ln", "mg", "nso", "pa", "ti", "wa"}
locales := []string{"ak", "bho", "csw", "guw", "ln", "mg", "nso", "pa", "ti", "wa"}
for _, locale := range locales {
runTests(t, locale, tests)
}
Expand Down Expand Up @@ -216,7 +216,7 @@ func TestLag(t *testing.T) {
}
}

func TestKsh(t *testing.T) {
func TestBlo(t *testing.T) {
var tests []pluralFormTest

tests = appendIntegerTests(tests, Zero, []string{"0"})
Expand All @@ -228,13 +228,13 @@ func TestKsh(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{"ksh"}
locales := []string{"blo"}
for _, locale := range locales {
runTests(t, locale, tests)
}
}

func TestBlo(t *testing.T) {
func TestKsh(t *testing.T) {
var tests []pluralFormTest

tests = appendIntegerTests(tests, Zero, []string{"0"})
Expand All @@ -243,10 +243,10 @@ func TestBlo(t *testing.T) {
tests = appendIntegerTests(tests, One, []string{"1"})
tests = appendDecimalTests(tests, One, []string{"1.0", "1.00", "1.000", "1.0000"})

tests = appendIntegerTests(tests, Other, []string{"2~16", "100", "1000", "10000", "100000", "1000000"})
tests = appendDecimalTests(tests, Other, []string{"2.0~2.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"})
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{"blo"}
locales := []string{"ksh"}
for _, locale := range locales {
runTests(t, locale, tests)
}
Expand Down Expand Up @@ -375,7 +375,7 @@ func TestPt(t *testing.T) {
}
}

func TestCaItPt_ptVec(t *testing.T) {
func TestCaItLldPt_ptScnVec(t *testing.T) {
var tests []pluralFormTest

tests = appendIntegerTests(tests, One, []string{"1"})
Expand All @@ -386,7 +386,7 @@ func TestCaItPt_ptVec(t *testing.T) {
tests = appendIntegerTests(tests, Other, []string{"0", "2~16", "100", "1000", "10000", "100000", "1000", "2000", "3000", "4000", "5000", "6000"})
tests = appendDecimalTests(tests, Other, []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0", "1.0001e3", "1.1e3", "2.0001e3", "2.1e3", "3.0001e3", "3.1e3"})

locales := []string{"ca", "it", "pt_PT", "vec"}
locales := []string{"ca", "it", "lld", "pt_PT", "scn", "vec"}
for _, locale := range locales {
runTests(t, locale, tests)
}
Expand Down
Loading