Skip to content

Commit

Permalink
i18n/language: add Macedonian
Browse files Browse the repository at this point in the history
  • Loading branch information
parkr committed Sep 26, 2015
1 parent 5bf37cc commit d5e77e0
Show file tree
Hide file tree
Showing 3 changed files with 28 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`)
* Macedonian (`mk`)
* Norweigan (`no`)
* Polish (`pl`)
* Portuguese (`pt`)
Expand Down
11 changes: 11 additions & 0 deletions i18n/language/pluralspec.go
Expand Up @@ -302,6 +302,17 @@ var pluralSpecs = map[string]*PluralSpec{
},
},

// Macedonian
"mk": &PluralSpec{
Plurals: newPluralSet(One, Other),
PluralFunc: func(ops *operands) Plural {
if (ops.V == 0 && ops.I%10 == 1) || ops.F%10 == 1 {
return One
}
return Other
},
},

// Norweigan
"no": &PluralSpec{
Plurals: newPluralSet(One, Other),
Expand Down
16 changes: 16 additions & 0 deletions i18n/language/pluralspec_test.go
Expand Up @@ -42,6 +42,8 @@ func TestGetPluralSpec(t *testing.T) {
{"ti", pluralSpecs["ti"]},
{"vi", pluralSpecs["vi"]},
{"vi-VN", pluralSpecs["vi"]},
{"mk", pluralSpecs["mk"]},
{"mk-MK", pluralSpecs["mk"]},
{".en-US..en-US.", nil},
{"zh, en-gb;q=0.8, en;q=0.7", nil},
{"zh,en-gb;q=0.8,en;q=0.7", nil},
Expand Down Expand Up @@ -380,6 +382,20 @@ func TestPortuguese(t *testing.T) {
runTests(t, "pt", tests)
}

func TestMacedonian(t *testing.T) {
tests := []pluralTest{
{0, Other},
{1, One},
{"1.1", One},
{"2.1", One},
{onePlusEpsilon, One},
{2, Other},
{"2.2", Other},
{11, One},
}
runTests(t, "mk", tests)
}

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

0 comments on commit d5e77e0

Please sign in to comment.