| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- {{ define "translator" }}
- package {{ .Locale }}
- import (
- "math"
- "github.com/go-playground/universal-translator/resources/locales"
- )
- type {{ .Locale }} struct {
- locale string
- plurals []locales.PluralRule
- decimal []byte
- group []byte
- minus []byte
- percent []byte
- perMille []byte
- symbol []byte
- }
- // New returns a new instance of translator for the '{{ .Locale }}' locale
- func New() locales.Translator {
- return &{{ .Locale }}{
- locale: "{{ .Locale }}",
- plurals: {{ .Plurals }},
- decimal: {{ .Decimal }},
- group: {{ .Group }},
- minus: {{ .Minus }},
- percent: {{ .Percent }},
- perMille: {{ .PerMille }},
- symbol: {{ .Symbol }},
- }
- }
- // Locale returns the current translators string locale
- func(t *{{ .Locale }}) Locale() string {
- return t.locale
- }
- // Plurals returns the list of plurals associated with '{{ .Locale }}'
- func(t *{{ .Locale }}) Plurals() []locales.PluralRule {
- return t.plurals
- }
- // cardinalPluralRule returns the PluralRule given 'num' and digits/precision of 'v' for '{{ .Locale }}'
- func(t *{{ .Locale }}) cardinalPluralRule(num float64, v uint64) locales.PluralRule {
- {{ .CardinalFunc }}
- }
- {{ end }}
|