Skip to content

Commit

Permalink
Merge pull request #34 from parkr/add-norweigan
Browse files Browse the repository at this point in the history
i18n/language: add Norweigan to pluralspec
  • Loading branch information
nicksnyder committed Sep 26, 2015
2 parents aca2437 + 736f57d commit 5bf37cc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -137,6 +137,7 @@ Supported languages
* Japanese (`ja`)
* Lithuanian (`lt`)
* Malay (`ms`)
* Norweigan (`no`)
* Polish (`pl`)
* Portuguese (`pt`)
* Portuguese (Brazilian) (`pt-BR`)
Expand Down
11 changes: 11 additions & 0 deletions i18n/language/pluralspec.go
Expand Up @@ -302,6 +302,17 @@ var pluralSpecs = map[string]*PluralSpec{
},
},

// Norweigan
"no": &PluralSpec{
Plurals: newPluralSet(One, Other),
PluralFunc: func(ops *operands) Plural {
if ops.I == 1 && ops.W == 0 {
return One
}
return Other
},
},

// Polish
"pl": &PluralSpec{
Plurals: newPluralSet(One, Few, Many, Other),
Expand Down
15 changes: 15 additions & 0 deletions i18n/language/pluralspec_test.go
Expand Up @@ -437,6 +437,21 @@ func TestSpanish(t *testing.T) {
runTests(t, "es", tests)
}

func TestNorweigan(t *testing.T) {
tests := []pluralTest{
{0, Other},
{1, One},
{"1", One},
{"1.0", One},
{"1.00", One},
{onePlusEpsilon, Other},
{2, Other},
}
tests = appendFloatTests(tests, 0.0, 0.9, Other)
tests = appendFloatTests(tests, 1.1, 10.0, Other)
runTests(t, "no", tests)
}

func TestBulgarian(t *testing.T) {
tests := []pluralTest{
{0, Other},
Expand Down

0 comments on commit 5bf37cc

Please sign in to comment.