Exemple #1
0
func human1024(list []string) func([]interface{}) []byte {
	return func(v []interface{}) []byte {
		r, ok := refl.Uint(v[0])
		if !ok {
			return nil
		}
		val, i, _ := human.Byten(r)
		if len(list) > int(i) {
			return []byte(val + list[i])
		}
		return nil
	}
}
Exemple #2
0
// HumanByteLong from full name
func humanByteLong(lang *i18n.Tlang) func([]interface{}) []byte {
	list, ok := lang.Lists["+prefix1000"]
	err.PanicBool(ok, "i18n list '+prefix1000' not found", 0)
	pluralByte, ok := lang.Plural["byte"]
	err.PanicBool(ok, "i18n plural 'byte' not found", 0)

	return func(v []interface{}) []byte {
		r, ok := refl.Uint(v[0])
		if !ok {
			return nil
		}
		val, i, valf := human.Byten(r)
		if !(len(list) > int(i)) {
			return nil
		}
		return []byte(val + " " + list[i] + pluralByte[lang.PluralRule(valf)])
	}
}