Documentation ¶
Overview ¶
Package plural provides support for pluralizing messages according to CLDR rules defined in http://cldr.unicode.org/index/cldr-spec/plural-rules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Form ¶
type Form string
Form represents a language pluralization form as defined here: http://cldr.unicode.org/index/cldr-spec/plural-rules
type Operands ¶
type Operands struct { N float64 // The absolute value of the source number (integer and decimals). I int64 // The integer digits of n. V int64 // The number of visible fraction digits in n, with trailing zeros. W int64 // The number of visible fraction digits in n, without trailing zeros. F int64 // The visible fractional digits in n, with trailing zeros. T int64 // The visible fractional digits in n, without trailing zeros. C int64 // The compact decimal exponent value: exponent of the power of 10 used in compact decimal formatting. E int64 // Currently, synonym for ‘c’. however, may be redefined in the future. }
Operands is a representation of CLDR Operands, see http://unicode.org/reports/tr35/tr35-numbers.html#Operands.
func NewOperands ¶
NewOperands returns the operands for the given number.
func (*Operands) NEqualsAny ¶
NEqualsAny returns true if o represents an integer equal to any of the arguments.
func (*Operands) NInRange ¶
NInRange returns true if o represents an integer in the closed interval [from, to].
func (*Operands) NModEqualsAny ¶
NModEqualsAny returns true if o represents an integer equal to any of the arguments modulo mod.
func (*Operands) NModInRange ¶
NModInRange returns true if o represents an integer in the closed interval [from, to] modulo mod.
type Rule ¶
Rule defines the CLDR plural rules for a language, see http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html.
type Rules ¶
Rules is a set of plural rules by language tag.
func DefaultRules ¶
func DefaultRules() Rules
DefaultRules returns a map of Rules generated from CLDR language data.