Documentation ¶
Index ¶
- func GetLocaleData(tag language.Tag) (*cldr.Locale, error)
- func NamedParameters(format string, params FmtParams) string
- type FmtParams
- type Locale
- func (l *Locale) FmtCurrency(currency string, number interface{}) (formatted string, err error)
- func (l *Locale) FmtCurrencyWhole(currency string, number interface{}) (formatted string, err error)
- func (l *Locale) FmtDateFull(tim time.Time) (string, error)
- func (l *Locale) FmtDateLong(tim time.Time) (string, error)
- func (l *Locale) FmtDateMedium(tim time.Time) (string, error)
- func (l *Locale) FmtDateShort(tim time.Time) (string, error)
- func (l *Locale) FmtDateTimeFull(tim time.Time) (string, error)
- func (l *Locale) FmtDateTimeLong(tim time.Time) (string, error)
- func (l *Locale) FmtDateTimeMedium(tim time.Time) (string, error)
- func (l *Locale) FmtDateTimeShort(tim time.Time) (string, error)
- func (l *Locale) FmtNumber(number interface{}) string
- func (l *Locale) FmtNumberWhole(number interface{}) string
- func (l *Locale) FmtPercent(number interface{}) string
- func (l *Locale) FmtTimeFull(tim time.Time) (string, error)
- func (l *Locale) FmtTimeLong(tim time.Time) (string, error)
- func (l *Locale) FmtTimeMedium(tim time.Time) (string, error)
- func (l *Locale) FmtTimeShort(tim time.Time) (string, error)
- func (l *Locale) Get(key string) string
- func (l *Locale) GetPlural(pluralID string, number interface{}, vars ...interface{}) string
- func (l *Locale) Load(source store.TranslationStore) error
- func (l *Locale) NewPrinter() *message.Printer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocaleData ¶
GetLocaleData finds the best match for tag and returns a *cldr.Locale, which contains data populated from the Unicode CLDR.
func NamedParameters ¶
NamedParameters does string formatting on python-style format strings like "Hello %(name)s".
Types ¶
type Locale ¶
type Locale struct { Tag language.Tag Number cldr.Number Calendar cldr.Calendar Plural cldr.Plural // contains filtered or unexported fields }
func GetLocale ¶
GetLocale returns a pointer to an existing, already-loaded locale (or nil if if doesn't exist)
func (*Locale) FmtCurrency ¶
func (*Locale) FmtCurrencyWhole ¶
func (*Locale) FmtDateTimeMedium ¶
func (*Locale) FmtNumberWhole ¶
func (*Locale) FmtPercent ¶
func (*Locale) GetPlural ¶
GetPlural determines which plural form should be used for the supplied number. number can be an int type (including int64) or a float formatted as a string. It then determines which plural form should be used by calling the cldr plural function, and returns the corresponding plural translation, formatted with the optional vars.
func (*Locale) Load ¶
func (l *Locale) Load(source store.TranslationStore) error
Load retrieves all translations from the supplied store.TranslationStore and prepares them for use in this Locale.
func (*Locale) NewPrinter ¶
NewPrinter creates a message.Printer for the Locale