summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nicksnyder/go-i18n/i18n/language
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/nicksnyder/go-i18n/i18n/language')
-rw-r--r--vendor/github.com/nicksnyder/go-i18n/i18n/language/codegen/main.go4
-rw-r--r--vendor/github.com/nicksnyder/go-i18n/i18n/language/codegen/plurals.xml18
-rw-r--r--vendor/github.com/nicksnyder/go-i18n/i18n/language/language_test.go4
-rw-r--r--vendor/github.com/nicksnyder/go-i18n/i18n/language/operands.go20
-rw-r--r--vendor/github.com/nicksnyder/go-i18n/i18n/language/operands_test.go24
-rw-r--r--vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec.go5
-rw-r--r--vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_gen.go166
-rw-r--r--vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_gen_test.go52
-rw-r--r--vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_test.go27
9 files changed, 138 insertions, 182 deletions
diff --git a/vendor/github.com/nicksnyder/go-i18n/i18n/language/codegen/main.go b/vendor/github.com/nicksnyder/go-i18n/i18n/language/codegen/main.go
index 5d6b6ad4f..58971033f 100644
--- a/vendor/github.com/nicksnyder/go-i18n/i18n/language/codegen/main.go
+++ b/vendor/github.com/nicksnyder/go-i18n/i18n/language/codegen/main.go
@@ -81,9 +81,9 @@ var codeTemplate = template.Must(template.New("spec").Parse(`package language
func init() {
{{range .PluralGroups}}
- registerPluralSpec({{printf "%#v" .SplitLocales}}, &PluralSpec{
+ RegisterPluralSpec({{printf "%#v" .SplitLocales}}, &PluralSpec{
Plurals: newPluralSet({{range $i, $e := .PluralRules}}{{if $i}}, {{end}}{{$e.CountTitle}}{{end}}),
- PluralFunc: func(ops *operands) Plural { {{range .PluralRules}}{{if .GoCondition}}
+ PluralFunc: func(ops *Operands) Plural { {{range .PluralRules}}{{if .GoCondition}}
// {{.Condition}}
if {{.GoCondition}} {
return {{.CountTitle}}
diff --git a/vendor/github.com/nicksnyder/go-i18n/i18n/language/codegen/plurals.xml b/vendor/github.com/nicksnyder/go-i18n/i18n/language/codegen/plurals.xml
index cdd0b5296..3310c8ee2 100644
--- a/vendor/github.com/nicksnyder/go-i18n/i18n/language/codegen/plurals.xml
+++ b/vendor/github.com/nicksnyder/go-i18n/i18n/language/codegen/plurals.xml
@@ -6,13 +6,13 @@ CLDR data files are interpreted according to the LDML specification (http://unic
For terms of use, see http://www.unicode.org/copyright.html
-->
<supplementalData>
- <version number="$Revision: 12002 $"/>
+ <version number="$Revision: 13253 $"/>
<plurals type="cardinal">
<!-- For a canonicalized list, use GeneratedPluralSamples -->
<!-- 1: other -->
- <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 zh">
+ <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">
<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>
</pluralRules>
@@ -26,6 +26,10 @@ For terms of use, see http://www.unicode.org/copyright.html
<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="pt">
+ <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 ca de en et fi fy gl it ji nl 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>
@@ -42,18 +46,10 @@ For terms of use, see http://www.unicode.org/copyright.html
<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>
<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>
</pluralRules>
- <pluralRules locales="pt">
- <pluralRule count="one">n = 0..2 and n != 2 @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>
<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 nah nb nd ne nn nnh no nr ny nyn om or os pap ps rm rof rwk saq 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">
<pluralRule count="one">n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000</pluralRule>
<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>
</pluralRules>
- <pluralRules locales="pt_PT">
- <pluralRule count="one">n = 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="da">
<pluralRule count="one">n = 1 or t != 0 and i = 0,1 @integer 1 @decimal 0.1~1.6</pluralRule>
<pluralRule count="other"> @integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0, 2.0~3.4, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
@@ -210,7 +206,7 @@ For terms of use, see http://www.unicode.org/copyright.html
<!-- 6: zero,one,two,few,many,other -->
- <pluralRules locales="ar">
+ <pluralRules locales="ar ars">
<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="two">n = 2 @integer 2 @decimal 2.0, 2.00, 2.000, 2.0000</pluralRule>
diff --git a/vendor/github.com/nicksnyder/go-i18n/i18n/language/language_test.go b/vendor/github.com/nicksnyder/go-i18n/i18n/language/language_test.go
index 2949bfe4a..1ab3314d6 100644
--- a/vendor/github.com/nicksnyder/go-i18n/i18n/language/language_test.go
+++ b/vendor/github.com/nicksnyder/go-i18n/i18n/language/language_test.go
@@ -18,8 +18,8 @@ func TestParse(t *testing.T) {
{"zh-TW", []*Language{{"zh-tw", pluralSpecs["zh"]}}},
{"pt-BR", []*Language{{"pt-br", pluralSpecs["pt"]}}},
{"pt_BR", []*Language{{"pt-br", pluralSpecs["pt"]}}},
- {"pt-PT", []*Language{{"pt-pt", pluralSpecs["pt-pt"]}}},
- {"pt_PT", []*Language{{"pt-pt", pluralSpecs["pt-pt"]}}},
+ {"pt-PT", []*Language{{"pt-pt", pluralSpecs["pt"]}}},
+ {"pt_PT", []*Language{{"pt-pt", pluralSpecs["pt"]}}},
{"zh-Hans-CN", []*Language{{"zh-hans-cn", pluralSpecs["zh"]}}},
{"zh-Hant-TW", []*Language{{"zh-hant-tw", pluralSpecs["zh"]}}},
{"en-US-en-US", []*Language{{"en-us-en-us", pluralSpecs["en"]}}},
diff --git a/vendor/github.com/nicksnyder/go-i18n/i18n/language/operands.go b/vendor/github.com/nicksnyder/go-i18n/i18n/language/operands.go
index 877bcc89d..49ee7dc7c 100644
--- a/vendor/github.com/nicksnyder/go-i18n/i18n/language/operands.go
+++ b/vendor/github.com/nicksnyder/go-i18n/i18n/language/operands.go
@@ -7,7 +7,7 @@ import (
)
// http://unicode.org/reports/tr35/tr35-numbers.html#Operands
-type operands struct {
+type Operands struct {
N float64 // absolute value of the source number (integer and decimals)
I int64 // integer digits of n
V int64 // number of visible fraction digits in n, with trailing zeros
@@ -17,7 +17,7 @@ type operands struct {
}
// NmodEqualAny returns true if o represents an integer equal to any of the arguments.
-func (o *operands) NequalsAny(any ...int64) bool {
+func (o *Operands) NequalsAny(any ...int64) bool {
for _, i := range any {
if o.I == i && o.T == 0 {
return true
@@ -27,7 +27,7 @@ func (o *operands) NequalsAny(any ...int64) bool {
}
// NmodEqualAny returns true if o represents an integer equal to any of the arguments modulo mod.
-func (o *operands) NmodEqualsAny(mod int64, any ...int64) bool {
+func (o *Operands) NmodEqualsAny(mod int64, any ...int64) bool {
modI := o.I % mod
for _, i := range any {
if modI == i && o.T == 0 {
@@ -38,17 +38,17 @@ func (o *operands) NmodEqualsAny(mod int64, any ...int64) bool {
}
// NmodInRange returns true if o represents an integer in the closed interval [from, to].
-func (o *operands) NinRange(from, to int64) bool {
+func (o *Operands) NinRange(from, to int64) bool {
return o.T == 0 && from <= o.I && o.I <= to
}
// NmodInRange returns true if o represents an integer in the closed interval [from, to] modulo mod.
-func (o *operands) NmodInRange(mod, from, to int64) bool {
+func (o *Operands) NmodInRange(mod, from, to int64) bool {
modI := o.I % mod
return o.T == 0 && from <= modI && modI <= to
}
-func newOperands(v interface{}) (*operands, error) {
+func newOperands(v interface{}) (*Operands, error) {
switch v := v.(type) {
case int:
return newOperandsInt64(int64(v)), nil
@@ -69,14 +69,14 @@ func newOperands(v interface{}) (*operands, error) {
}
}
-func newOperandsInt64(i int64) *operands {
+func newOperandsInt64(i int64) *Operands {
if i < 0 {
i = -i
}
- return &operands{float64(i), i, 0, 0, 0, 0}
+ return &Operands{float64(i), i, 0, 0, 0, 0}
}
-func newOperandsString(s string) (*operands, error) {
+func newOperandsString(s string) (*Operands, error) {
if s[0] == '-' {
s = s[1:]
}
@@ -84,7 +84,7 @@ func newOperandsString(s string) (*operands, error) {
if err != nil {
return nil, err
}
- ops := &operands{N: n}
+ ops := &Operands{N: n}
parts := strings.SplitN(s, ".", 2)
ops.I, err = strconv.ParseInt(parts[0], 10, 64)
if err != nil {
diff --git a/vendor/github.com/nicksnyder/go-i18n/i18n/language/operands_test.go b/vendor/github.com/nicksnyder/go-i18n/i18n/language/operands_test.go
index 29030876a..e4f33902b 100644
--- a/vendor/github.com/nicksnyder/go-i18n/i18n/language/operands_test.go
+++ b/vendor/github.com/nicksnyder/go-i18n/i18n/language/operands_test.go
@@ -8,20 +8,20 @@ import (
func TestNewOperands(t *testing.T) {
tests := []struct {
input interface{}
- ops *operands
+ ops *Operands
err bool
}{
- {int64(0), &operands{0.0, 0, 0, 0, 0, 0}, false},
- {int64(1), &operands{1.0, 1, 0, 0, 0, 0}, false},
- {"0", &operands{0.0, 0, 0, 0, 0, 0}, false},
- {"1", &operands{1.0, 1, 0, 0, 0, 0}, false},
- {"1.0", &operands{1.0, 1, 1, 0, 0, 0}, false},
- {"1.00", &operands{1.0, 1, 2, 0, 0, 0}, false},
- {"1.3", &operands{1.3, 1, 1, 1, 3, 3}, false},
- {"1.30", &operands{1.3, 1, 2, 1, 30, 3}, false},
- {"1.03", &operands{1.03, 1, 2, 2, 3, 3}, false},
- {"1.230", &operands{1.23, 1, 3, 2, 230, 23}, false},
- {"20.0230", &operands{20.023, 20, 4, 3, 230, 23}, false},
+ {int64(0), &Operands{0.0, 0, 0, 0, 0, 0}, false},
+ {int64(1), &Operands{1.0, 1, 0, 0, 0, 0}, false},
+ {"0", &Operands{0.0, 0, 0, 0, 0, 0}, false},
+ {"1", &Operands{1.0, 1, 0, 0, 0, 0}, false},
+ {"1.0", &Operands{1.0, 1, 1, 0, 0, 0}, false},
+ {"1.00", &Operands{1.0, 1, 2, 0, 0, 0}, false},
+ {"1.3", &Operands{1.3, 1, 1, 1, 3, 3}, false},
+ {"1.30", &Operands{1.3, 1, 2, 1, 30, 3}, false},
+ {"1.03", &Operands{1.03, 1, 2, 2, 3, 3}, false},
+ {"1.230", &Operands{1.23, 1, 3, 2, 230, 23}, false},
+ {"20.0230", &Operands{20.023, 20, 4, 3, 230, 23}, false},
{20.0230, nil, true},
}
for _, test := range tests {
diff --git a/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec.go b/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec.go
index fc3522682..85b2a1b37 100644
--- a/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec.go
+++ b/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec.go
@@ -7,7 +7,7 @@ import "strings"
// http://unicode.org/reports/tr35/tr35-numbers.html#Operands
type PluralSpec struct {
Plurals map[Plural]struct{}
- PluralFunc func(*operands) Plural
+ PluralFunc func(*Operands) Plural
}
var pluralSpecs = make(map[string]*PluralSpec)
@@ -18,7 +18,8 @@ func normalizePluralSpecID(id string) string {
return id
}
-func registerPluralSpec(ids []string, ps *PluralSpec) {
+// RegisterPluralSpec registers a new plural spec for the language ids.
+func RegisterPluralSpec(ids []string, ps *PluralSpec) {
for _, id := range ids {
id = normalizePluralSpecID(id)
pluralSpecs[id] = ps
diff --git a/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_gen.go b/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_gen.go
index c9b4f2667..0268bb92c 100644
--- a/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_gen.go
+++ b/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_gen.go
@@ -4,15 +4,15 @@ package language
func init() {
- registerPluralSpec([]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", "zh"}, &PluralSpec{
+ RegisterPluralSpec([]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"}, &PluralSpec{
Plurals: newPluralSet(Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
return Other
},
})
- registerPluralSpec([]string{"am", "as", "bn", "fa", "gu", "hi", "kn", "mr", "zu"}, &PluralSpec{
+ RegisterPluralSpec([]string{"am", "as", "bn", "fa", "gu", "hi", "kn", "mr", "zu"}, &PluralSpec{
Plurals: newPluralSet(One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// i = 0 or n = 1
if intEqualsAny(ops.I, 0) ||
ops.NequalsAny(1) {
@@ -21,9 +21,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"ff", "fr", "hy", "kab"}, &PluralSpec{
+ RegisterPluralSpec([]string{"ff", "fr", "hy", "kab"}, &PluralSpec{
Plurals: newPluralSet(One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// i = 0,1
if intEqualsAny(ops.I, 0, 1) {
return One
@@ -31,9 +31,19 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"ast", "ca", "de", "en", "et", "fi", "fy", "gl", "it", "ji", "nl", "sv", "sw", "ur", "yi"}, &PluralSpec{
+ RegisterPluralSpec([]string{"pt"}, &PluralSpec{
Plurals: newPluralSet(One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
+ // i = 0..1
+ if intInRange(ops.I, 0, 1) {
+ return One
+ }
+ return Other
+ },
+ })
+ RegisterPluralSpec([]string{"ast", "ca", "de", "en", "et", "fi", "fy", "gl", "it", "ji", "nl", "sv", "sw", "ur", "yi"}, &PluralSpec{
+ Plurals: newPluralSet(One, Other),
+ PluralFunc: func(ops *Operands) Plural {
// i = 1 and v = 0
if intEqualsAny(ops.I, 1) && intEqualsAny(ops.V, 0) {
return One
@@ -41,9 +51,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"si"}, &PluralSpec{
+ RegisterPluralSpec([]string{"si"}, &PluralSpec{
Plurals: newPluralSet(One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n = 0,1 or i = 0 and f = 1
if ops.NequalsAny(0, 1) ||
intEqualsAny(ops.I, 0) && intEqualsAny(ops.F, 1) {
@@ -52,9 +62,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"ak", "bh", "guw", "ln", "mg", "nso", "pa", "ti", "wa"}, &PluralSpec{
+ RegisterPluralSpec([]string{"ak", "bh", "guw", "ln", "mg", "nso", "pa", "ti", "wa"}, &PluralSpec{
Plurals: newPluralSet(One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n = 0..1
if ops.NinRange(0, 1) {
return One
@@ -62,9 +72,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"tzm"}, &PluralSpec{
+ RegisterPluralSpec([]string{"tzm"}, &PluralSpec{
Plurals: newPluralSet(One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n = 0..1 or n = 11..99
if ops.NinRange(0, 1) ||
ops.NinRange(11, 99) {
@@ -73,19 +83,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"pt"}, &PluralSpec{
- Plurals: newPluralSet(One, Other),
- PluralFunc: func(ops *operands) Plural {
- // n = 0..2 and n != 2
- if ops.NinRange(0, 2) && !ops.NequalsAny(2) {
- return One
- }
- return Other
- },
- })
- registerPluralSpec([]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", "nah", "nb", "nd", "ne", "nn", "nnh", "no", "nr", "ny", "nyn", "om", "or", "os", "pap", "ps", "rm", "rof", "rwk", "saq", "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"}, &PluralSpec{
+ RegisterPluralSpec([]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", "nah", "nb", "nd", "ne", "nn", "nnh", "no", "nr", "ny", "nyn", "om", "or", "os", "pap", "ps", "rm", "rof", "rwk", "saq", "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"}, &PluralSpec{
Plurals: newPluralSet(One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n = 1
if ops.NequalsAny(1) {
return One
@@ -93,19 +93,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"pt_PT"}, &PluralSpec{
- Plurals: newPluralSet(One, Other),
- PluralFunc: func(ops *operands) Plural {
- // n = 1 and v = 0
- if ops.NequalsAny(1) && intEqualsAny(ops.V, 0) {
- return One
- }
- return Other
- },
- })
- registerPluralSpec([]string{"da"}, &PluralSpec{
+ RegisterPluralSpec([]string{"da"}, &PluralSpec{
Plurals: newPluralSet(One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n = 1 or t != 0 and i = 0,1
if ops.NequalsAny(1) ||
!intEqualsAny(ops.T, 0) && intEqualsAny(ops.I, 0, 1) {
@@ -114,9 +104,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"is"}, &PluralSpec{
+ RegisterPluralSpec([]string{"is"}, &PluralSpec{
Plurals: newPluralSet(One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// t = 0 and i % 10 = 1 and i % 100 != 11 or t != 0
if intEqualsAny(ops.T, 0) && intEqualsAny(ops.I%10, 1) && !intEqualsAny(ops.I%100, 11) ||
!intEqualsAny(ops.T, 0) {
@@ -125,9 +115,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"mk"}, &PluralSpec{
+ RegisterPluralSpec([]string{"mk"}, &PluralSpec{
Plurals: newPluralSet(One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// v = 0 and i % 10 = 1 or f % 10 = 1
if intEqualsAny(ops.V, 0) && intEqualsAny(ops.I%10, 1) ||
intEqualsAny(ops.F%10, 1) {
@@ -136,9 +126,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"fil", "tl"}, &PluralSpec{
+ RegisterPluralSpec([]string{"fil", "tl"}, &PluralSpec{
Plurals: newPluralSet(One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// v = 0 and i = 1,2,3 or v = 0 and i % 10 != 4,6,9 or v != 0 and f % 10 != 4,6,9
if intEqualsAny(ops.V, 0) && intEqualsAny(ops.I, 1, 2, 3) ||
intEqualsAny(ops.V, 0) && !intEqualsAny(ops.I%10, 4, 6, 9) ||
@@ -148,9 +138,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"lv", "prg"}, &PluralSpec{
+ RegisterPluralSpec([]string{"lv", "prg"}, &PluralSpec{
Plurals: newPluralSet(Zero, One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19
if ops.NmodEqualsAny(10, 0) ||
ops.NmodInRange(100, 11, 19) ||
@@ -166,9 +156,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"lag"}, &PluralSpec{
+ RegisterPluralSpec([]string{"lag"}, &PluralSpec{
Plurals: newPluralSet(Zero, One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n = 0
if ops.NequalsAny(0) {
return Zero
@@ -180,9 +170,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"ksh"}, &PluralSpec{
+ RegisterPluralSpec([]string{"ksh"}, &PluralSpec{
Plurals: newPluralSet(Zero, One, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n = 0
if ops.NequalsAny(0) {
return Zero
@@ -194,9 +184,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"iu", "kw", "naq", "se", "sma", "smi", "smj", "smn", "sms"}, &PluralSpec{
+ RegisterPluralSpec([]string{"iu", "kw", "naq", "se", "sma", "smi", "smj", "smn", "sms"}, &PluralSpec{
Plurals: newPluralSet(One, Two, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n = 1
if ops.NequalsAny(1) {
return One
@@ -208,9 +198,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"shi"}, &PluralSpec{
+ RegisterPluralSpec([]string{"shi"}, &PluralSpec{
Plurals: newPluralSet(One, Few, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// i = 0 or n = 1
if intEqualsAny(ops.I, 0) ||
ops.NequalsAny(1) {
@@ -223,9 +213,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"mo", "ro"}, &PluralSpec{
+ RegisterPluralSpec([]string{"mo", "ro"}, &PluralSpec{
Plurals: newPluralSet(One, Few, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// i = 1 and v = 0
if intEqualsAny(ops.I, 1) && intEqualsAny(ops.V, 0) {
return One
@@ -239,9 +229,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"bs", "hr", "sh", "sr"}, &PluralSpec{
+ RegisterPluralSpec([]string{"bs", "hr", "sh", "sr"}, &PluralSpec{
Plurals: newPluralSet(One, Few, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// v = 0 and i % 10 = 1 and i % 100 != 11 or f % 10 = 1 and f % 100 != 11
if intEqualsAny(ops.V, 0) && intEqualsAny(ops.I%10, 1) && !intEqualsAny(ops.I%100, 11) ||
intEqualsAny(ops.F%10, 1) && !intEqualsAny(ops.F%100, 11) {
@@ -255,9 +245,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"gd"}, &PluralSpec{
+ RegisterPluralSpec([]string{"gd"}, &PluralSpec{
Plurals: newPluralSet(One, Two, Few, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n = 1,11
if ops.NequalsAny(1, 11) {
return One
@@ -273,9 +263,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"sl"}, &PluralSpec{
+ RegisterPluralSpec([]string{"sl"}, &PluralSpec{
Plurals: newPluralSet(One, Two, Few, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// v = 0 and i % 100 = 1
if intEqualsAny(ops.V, 0) && intEqualsAny(ops.I%100, 1) {
return One
@@ -292,9 +282,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"dsb", "hsb"}, &PluralSpec{
+ RegisterPluralSpec([]string{"dsb", "hsb"}, &PluralSpec{
Plurals: newPluralSet(One, Two, Few, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// v = 0 and i % 100 = 1 or f % 100 = 1
if intEqualsAny(ops.V, 0) && intEqualsAny(ops.I%100, 1) ||
intEqualsAny(ops.F%100, 1) {
@@ -313,9 +303,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"he", "iw"}, &PluralSpec{
+ RegisterPluralSpec([]string{"he", "iw"}, &PluralSpec{
Plurals: newPluralSet(One, Two, Many, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// i = 1 and v = 0
if intEqualsAny(ops.I, 1) && intEqualsAny(ops.V, 0) {
return One
@@ -331,9 +321,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"cs", "sk"}, &PluralSpec{
+ RegisterPluralSpec([]string{"cs", "sk"}, &PluralSpec{
Plurals: newPluralSet(One, Few, Many, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// i = 1 and v = 0
if intEqualsAny(ops.I, 1) && intEqualsAny(ops.V, 0) {
return One
@@ -349,9 +339,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"pl"}, &PluralSpec{
+ RegisterPluralSpec([]string{"pl"}, &PluralSpec{
Plurals: newPluralSet(One, Few, Many, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// i = 1 and v = 0
if intEqualsAny(ops.I, 1) && intEqualsAny(ops.V, 0) {
return One
@@ -369,9 +359,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"be"}, &PluralSpec{
+ RegisterPluralSpec([]string{"be"}, &PluralSpec{
Plurals: newPluralSet(One, Few, Many, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n % 10 = 1 and n % 100 != 11
if ops.NmodEqualsAny(10, 1) && !ops.NmodEqualsAny(100, 11) {
return One
@@ -389,9 +379,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"lt"}, &PluralSpec{
+ RegisterPluralSpec([]string{"lt"}, &PluralSpec{
Plurals: newPluralSet(One, Few, Many, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n % 10 = 1 and n % 100 != 11..19
if ops.NmodEqualsAny(10, 1) && !ops.NmodInRange(100, 11, 19) {
return One
@@ -407,9 +397,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"mt"}, &PluralSpec{
+ RegisterPluralSpec([]string{"mt"}, &PluralSpec{
Plurals: newPluralSet(One, Few, Many, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n = 1
if ops.NequalsAny(1) {
return One
@@ -426,9 +416,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"ru", "uk"}, &PluralSpec{
+ RegisterPluralSpec([]string{"ru", "uk"}, &PluralSpec{
Plurals: newPluralSet(One, Few, Many, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// v = 0 and i % 10 = 1 and i % 100 != 11
if intEqualsAny(ops.V, 0) && intEqualsAny(ops.I%10, 1) && !intEqualsAny(ops.I%100, 11) {
return One
@@ -446,9 +436,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"br"}, &PluralSpec{
+ RegisterPluralSpec([]string{"br"}, &PluralSpec{
Plurals: newPluralSet(One, Two, Few, Many, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n % 10 = 1 and n % 100 != 11,71,91
if ops.NmodEqualsAny(10, 1) && !ops.NmodEqualsAny(100, 11, 71, 91) {
return One
@@ -468,9 +458,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"ga"}, &PluralSpec{
+ RegisterPluralSpec([]string{"ga"}, &PluralSpec{
Plurals: newPluralSet(One, Two, Few, Many, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n = 1
if ops.NequalsAny(1) {
return One
@@ -490,9 +480,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"gv"}, &PluralSpec{
+ RegisterPluralSpec([]string{"gv"}, &PluralSpec{
Plurals: newPluralSet(One, Two, Few, Many, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// v = 0 and i % 10 = 1
if intEqualsAny(ops.V, 0) && intEqualsAny(ops.I%10, 1) {
return One
@@ -512,9 +502,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"ar"}, &PluralSpec{
+ RegisterPluralSpec([]string{"ar", "ars"}, &PluralSpec{
Plurals: newPluralSet(Zero, One, Two, Few, Many, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n = 0
if ops.NequalsAny(0) {
return Zero
@@ -538,9 +528,9 @@ func init() {
return Other
},
})
- registerPluralSpec([]string{"cy"}, &PluralSpec{
+ RegisterPluralSpec([]string{"cy"}, &PluralSpec{
Plurals: newPluralSet(Zero, One, Two, Few, Many, Other),
- PluralFunc: func(ops *operands) Plural {
+ PluralFunc: func(ops *Operands) Plural {
// n = 0
if ops.NequalsAny(0) {
return Zero
diff --git a/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_gen_test.go b/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_gen_test.go
index c8ec41fd4..4cfa97bdf 100644
--- a/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_gen_test.go
+++ b/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_gen_test.go
@@ -4,13 +4,13 @@ package language
import "testing"
-func TestBmBoDzIdIgIiInJaJboJvJwKdeKeaKmKoLktLoMsMyNqoRootSahSesSgThToViWoYoZh(t *testing.T) {
+func TestBmBoDzIdIgIiInJaJboJvJwKdeKeaKmKoLktLoMsMyNqoRootSahSesSgThToViWoYoYueZh(t *testing.T) {
var tests []pluralTest
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", "zh"}
+ 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"}
for _, locale := range locales {
runTests(t, locale, tests)
}
@@ -46,6 +46,21 @@ func TestFfFrHyKab(t *testing.T) {
}
}
+func TestPt(t *testing.T) {
+ var tests []pluralTest
+
+ tests = appendIntegerTests(tests, One, []string{"0", "1"})
+ tests = appendDecimalTests(tests, One, []string{"0.0~1.5"})
+
+ tests = appendIntegerTests(tests, Other, []string{"2~17", "100", "1000", "10000", "100000", "1000000"})
+ tests = appendDecimalTests(tests, Other, []string{"2.0~3.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"})
+
+ locales := []string{"pt"}
+ for _, locale := range locales {
+ runTests(t, locale, tests)
+ }
+}
+
func TestAstCaDeEnEtFiFyGlItJiNlSvSwUrYi(t *testing.T) {
var tests []pluralTest
@@ -105,21 +120,6 @@ func TestTzm(t *testing.T) {
}
}
-func TestPt(t *testing.T) {
- var tests []pluralTest
-
- tests = appendIntegerTests(tests, One, []string{"0", "1"})
- tests = appendDecimalTests(tests, One, []string{"0.0", "1.0", "0.00", "1.00", "0.000", "1.000", "0.0000", "1.0000"})
-
- 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{"pt"}
- for _, locale := range locales {
- runTests(t, locale, tests)
- }
-}
-
func TestAfAsaAzBemBezBgBrxCeCggChrCkbDvEeElEoEsEuFoFurGswHaHawHuJgoJmcKaKajKcgKkKkjKlKsKsbKuKyLbLgMasMgoMlMnNahNbNdNeNnNnhNoNrNyNynOmOrOsPapPsRmRofRwkSaqSdhSehSnSoSqSsSsyStSyrTaTeTeoTigTkTnTrTsUgUzVeVoVunWaeXhXog(t *testing.T) {
var tests []pluralTest
@@ -135,20 +135,6 @@ func TestAfAsaAzBemBezBgBrxCeCggChrCkbDvEeElEoEsEuFoFurGswHaHawHuJgoJmcKaKajKcgK
}
}
-func TestPt_PT(t *testing.T) {
- var tests []pluralTest
-
- 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{"pt_PT"}
- for _, locale := range locales {
- runTests(t, locale, tests)
- }
-}
-
func TestDa(t *testing.T) {
var tests []pluralTest
@@ -590,7 +576,7 @@ func TestGv(t *testing.T) {
}
}
-func TestAr(t *testing.T) {
+func TestArArs(t *testing.T) {
var tests []pluralTest
tests = appendIntegerTests(tests, Zero, []string{"0"})
@@ -611,7 +597,7 @@ func TestAr(t *testing.T) {
tests = appendIntegerTests(tests, Other, []string{"100~102", "200~202", "300~302", "400~402", "500~502", "600", "1000", "10000", "100000", "1000000"})
tests = appendDecimalTests(tests, Other, []string{"0.1~0.9", "1.1~1.7", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"})
- locales := []string{"ar"}
+ locales := []string{"ar", "ars"}
for _, locale := range locales {
runTests(t, locale, tests)
}
diff --git a/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_test.go b/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_test.go
index 34931b7bb..919b489bd 100644
--- a/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_test.go
+++ b/vendor/github.com/nicksnyder/go-i18n/i18n/language/pluralspec_test.go
@@ -23,8 +23,8 @@ func TestGetPluralSpec(t *testing.T) {
{"zh-TW", pluralSpecs["zh"]},
{"pt-BR", pluralSpecs["pt"]},
{"pt_BR", pluralSpecs["pt"]},
- {"pt-PT", pluralSpecs["pt-pt"]},
- {"pt_PT", pluralSpecs["pt-pt"]},
+ {"pt-PT", pluralSpecs["pt"]},
+ {"pt_PT", pluralSpecs["pt"]},
{"zh-Hans-CN", pluralSpecs["zh"]},
{"zh-Hant-TW", pluralSpecs["zh"]},
{"zh-CN", pluralSpecs["zh"]},
@@ -462,11 +462,11 @@ func TestPortuguese(t *testing.T) {
{"0.0", One},
{1, One},
{"1.0", One},
- {onePlusEpsilon, Other},
+ {onePlusEpsilon, One},
{2, Other},
}
- tests = appendFloatTests(tests, 0.1, 0.9, Other)
- tests = appendFloatTests(tests, 1.1, 10.0, Other)
+ tests = appendFloatTests(tests, 0, 1.5, One)
+ tests = appendFloatTests(tests, 2, 10.0, Other)
runTests(t, "pt", tests)
}
@@ -484,23 +484,6 @@ func TestMacedonian(t *testing.T) {
runTests(t, "mk", tests)
}
-func TestPortugueseEuropean(t *testing.T) {
- tests := []pluralTest{
- {0, Other},
- {"0.0", Other},
- {"0.1", Other},
- {"0.01", Other},
- {1, One},
- {"1", One},
- {"1.1", Other},
- {"1.01", Other},
- {onePlusEpsilon, Other},
- {2, Other},
- }
- tests = appendFloatTests(tests, 2.0, 10.0, Other)
- runTests(t, "pt-pt", tests)
-}
-
func TestRussian(t *testing.T) {
tests := []pluralTest{
{0, Many},