4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-09-18 21:52:32 +00:00
Files
bridge
matterclient
matterhook
vendor
github.com
42wim
Sirupsen
alecthomas
gorilla
jpillora
mattermost
nicksnyder
go-i18n
i18n
bundle
language
codegen
language.go
operands.go
plural.go
pluralspec.go
pluralspec_gen.go
translation
LICENSE
i18n.go
pborman
peterhellberg
sorcix
thoj
golang.org
gopkg.in
manifest
Dockerfile
LICENSE
README.md
matterbridge.conf.sample
matterbridge.go
matterbridge/vendor/github.com/nicksnyder/go-i18n/i18n/language/plural.go
2016-04-10 23:39:38 +02:00

41 lines
824 B
Go

package language
import (
"fmt"
)
// Plural represents a language pluralization form as defined here:
// http://cldr.unicode.org/index/cldr-spec/plural-rules
type Plural string
// All defined plural categories.
const (
Invalid Plural = "invalid"
Zero = "zero"
One = "one"
Two = "two"
Few = "few"
Many = "many"
Other = "other"
)
// NewPlural returns src as a Plural
// or Invalid and a non-nil error if src is not a valid Plural.
func NewPlural(src string) (Plural, error) {
switch src {
case "zero":
return Zero, nil
case "one":
return One, nil
case "two":
return Two, nil
case "few":
return Few, nil
case "many":
return Many, nil
case "other":
return Other, nil
}
return Invalid, fmt.Errorf("invalid plural category %s", src)
}