本文整理匯總了Golang中github.com/go-playground/locales.F函數的典型用法代碼示例。如果您正苦於以下問題:Golang F函數的具體用法?Golang F怎麽用?Golang F使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了F函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: CardinalPluralRule
// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'si_LK'
func (si *si_LK) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
i := int64(n)
f := locales.F(n, v)
if (n == 0 || n == 1) || (i == 0 && f == 1) {
return locales.PluralRuleOne
}
return locales.PluralRuleOther
}
示例2: CardinalPluralRule
// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'mk_MK'
func (mk *mk_MK) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
i := int64(n)
f := locales.F(n, v)
iMod10 := i % 10
fMod10 := f % 10
if (v == 0 && iMod10 == 1) || (fMod10 == 1) {
return locales.PluralRuleOne
}
return locales.PluralRuleOther
}
示例3: CardinalPluralRule
// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'fil'
func (fil *fil) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
i := int64(n)
f := locales.F(n, v)
iMod10 := i % 10
fMod10 := f % 10
if (v == 0 && (i == 1 || i == 2 || i == 3)) || (v == 0 && (iMod10 != 4 && iMod10 != 6 && iMod10 != 9)) || (v != 0 && (fMod10 != 4 && fMod10 != 6 && fMod10 != 9)) {
return locales.PluralRuleOne
}
return locales.PluralRuleOther
}
示例4: CardinalPluralRule
// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'lv'
func (lv *lv) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
f := locales.F(n, v)
nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
fMod100 := f % 100
fMod10 := f % 10
if (nMod10 == 0) || (nMod100 >= 11 && nMod100 <= 19) || (v == 2 && fMod100 >= 11 && fMod100 <= 19) {
return locales.PluralRuleZero
} else if (nMod10 == 1 && nMod100 != 11) || (v == 2 && fMod10 == 1 && fMod100 != 11) || (v != 2 && fMod10 == 1) {
return locales.PluralRuleOne
}
return locales.PluralRuleOther
}
示例5: CardinalPluralRule
// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'lt'
func (lt *lt) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
f := locales.F(n, v)
nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
if nMod10 == 1 && (nMod100 < 11 || nMod100 > 19) {
return locales.PluralRuleOne
} else if nMod10 >= 2 && nMod10 <= 9 && (nMod100 < 11 || nMod100 > 19) {
return locales.PluralRuleFew
} else if f != 0 {
return locales.PluralRuleMany
}
return locales.PluralRuleOther
}
示例6: CardinalPluralRule
// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'hsb'
func (hsb *hsb) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
i := int64(n)
f := locales.F(n, v)
iMod100 := i % 100
fMod100 := f % 100
if (v == 0 && iMod100 == 1) || (fMod100 == 1) {
return locales.PluralRuleOne
} else if (v == 0 && iMod100 == 2) || (fMod100 == 2) {
return locales.PluralRuleTwo
} else if (v == 0 && iMod100 >= 3 && iMod100 <= 4) || (fMod100 >= 3 && fMod100 <= 4) {
return locales.PluralRuleFew
}
return locales.PluralRuleOther
}
示例7: CardinalPluralRule
// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'hr'
func (hr *hr) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
i := int64(n)
f := locales.F(n, v)
iMod10 := i % 10
iMod100 := i % 100
fMod10 := f % 10
fMod100 := f % 100
if (v == 0 && iMod10 == 1 && iMod100 != 11) || (fMod10 == 1 && fMod100 != 11) {
return locales.PluralRuleOne
} else if (v == 0 && iMod10 >= 2 && iMod10 <= 4 && (iMod100 < 12 || iMod100 > 14)) || (fMod10 >= 2 && fMod10 <= 4 && (fMod100 < 12 || fMod100 > 14)) {
return locales.PluralRuleFew
}
return locales.PluralRuleOther
}