kubernetes/vendor/golang.org/x/text/feature/plural/plural.go

type Rules

var Cardinal

var Ordinal

var ordinal

var cardinal

// getIntApprox converts the digits in slice digits[start:end] to an integer
// according to the following rules:
//   - Let i be asInt(digits[start:end]), where out-of-range digits are assumed
//     to be zero.
//   - Result n is big if i / 10^nMod > 1.
//   - Otherwise the result is i % 10^nMod.
//
// For example, if digits is {1, 2, 3} and start:end is 0:5, then the result
// for various values of nMod is:
//   - when nMod == 2, n == big
//   - when nMod == 3, n == big
//   - when nMod == 4, n == big
//   - when nMod == 5, n == 12300
//   - when nMod == 6, n == 12300
//   - when nMod == 7, n == 12300
func getIntApprox(digits []byte, start, end, nMod, big int) (n int) {}

// MatchDigits computes the plural form for the given language and the given
// decimal floating point digits. The digits are stored in big-endian order and
// are of value byte(0) - byte(9). The floating point position is indicated by
// exp and the number of visible decimals is scale. All leading and trailing
// zeros may be omitted from digits.
//
// The following table contains examples of possible arguments to represent
// the given numbers.
//
//	decimal    digits              exp    scale
//	123        []byte{1, 2, 3}     3      0
//	123.4      []byte{1, 2, 3, 4}  3      1
//	123.40     []byte{1, 2, 3, 4}  3      2
//	100000     []byte{1}           6      0
//	100000.00  []byte{1}           6      3
func (p *Rules) MatchDigits(t language.Tag, digits []byte, exp, scale int) Form {}

func (p *Rules) matchDisplayDigits(t language.Tag, d *number.Digits) (Form, int) {}

func validForms(p *Rules, t language.Tag) (forms []Form) {}

func (p *Rules) matchComponents(t language.Tag, n, f, scale int) Form {}

// MatchPlural returns the plural form for the given language and plural
// operands (as defined in
// https://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules):
//
//	where
//		n  absolute value of the source number (integer and decimals)
//	input
//		i  integer digits of n.
//		v  number of visible fraction digits in n, with trailing zeros.
//		w  number of visible fraction digits in n, without trailing zeros.
//		f  visible fractional digits in n, with trailing zeros (f = t * 10^(v-w))
//		t  visible fractional digits in n, without trailing zeros.
//
// If any of the operand values is too large to fit in an int, it is okay to
// pass the value modulo 10,000,000.
func (p *Rules) MatchPlural(lang language.Tag, i, v, w, f, t int) Form {}

func matchPlural(p *Rules, index compact.ID, n, f, v int) Form {}

func tagToID(t language.Tag) compact.ID {}