localizer

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2020 License: MIT Imports: 13 Imported by: 1

README

#TODO

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocaleData

func GetLocaleData(tag language.Tag) (*cldr.Locale, error)

GetLocaleData finds the best match for tag and returns a *cldr.Locale, which contains data populated from the Unicode CLDR.

func NamedParameters

func NamedParameters(format string, params FmtParams) string

NamedParameters does string formatting on python-style format strings like "Hello %(name)s".

Types

type FmtParams

type FmtParams map[string]interface{}

type Locale

type Locale struct {
	Tag      language.Tag
	Number   cldr.Number
	Calendar cldr.Calendar
	Plural   cldr.Plural
	// contains filtered or unexported fields
}

func GetLocale

func GetLocale(tag language.Tag) *Locale

GetLocale returns a pointer to an existing, already-loaded locale (or nil if if doesn't exist)

func NewLocale

func NewLocale(tag language.Tag) (loc *Locale, err error)

NewLocale instantiates a new Locale for the supplied language tag.

func (*Locale) FmtCurrency

func (l *Locale) FmtCurrency(currency string, number interface{}) (formatted string, err error)

func (*Locale) FmtCurrencyWhole

func (l *Locale) FmtCurrencyWhole(currency string, number interface{}) (formatted string, err error)

func (*Locale) FmtDateFull

func (l *Locale) FmtDateFull(tim time.Time) (string, error)

func (*Locale) FmtDateLong

func (l *Locale) FmtDateLong(tim time.Time) (string, error)

func (*Locale) FmtDateMedium

func (l *Locale) FmtDateMedium(tim time.Time) (string, error)

func (*Locale) FmtDateShort

func (l *Locale) FmtDateShort(tim time.Time) (string, error)

func (*Locale) FmtDateTimeFull

func (l *Locale) FmtDateTimeFull(tim time.Time) (string, error)

func (*Locale) FmtDateTimeLong

func (l *Locale) FmtDateTimeLong(tim time.Time) (string, error)

func (*Locale) FmtDateTimeMedium

func (l *Locale) FmtDateTimeMedium(tim time.Time) (string, error)

func (*Locale) FmtDateTimeShort

func (l *Locale) FmtDateTimeShort(tim time.Time) (string, error)

func (*Locale) FmtNumber

func (l *Locale) FmtNumber(number interface{}) string

func (*Locale) FmtNumberWhole

func (l *Locale) FmtNumberWhole(number interface{}) string

func (*Locale) FmtPercent

func (l *Locale) FmtPercent(number interface{}) string

func (*Locale) FmtTimeFull

func (l *Locale) FmtTimeFull(tim time.Time) (string, error)

func (*Locale) FmtTimeLong

func (l *Locale) FmtTimeLong(tim time.Time) (string, error)

func (*Locale) FmtTimeMedium

func (l *Locale) FmtTimeMedium(tim time.Time) (string, error)

func (*Locale) FmtTimeShort

func (l *Locale) FmtTimeShort(tim time.Time) (string, error)

func (*Locale) Get

func (l *Locale) Get(key string) string

Get returns the raw translated string from the catalog, with no formatting.

func (*Locale) GetPlural

func (l *Locale) GetPlural(pluralID string, number interface{}, vars ...interface{}) string

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

func (l *Locale) NewPrinter() *message.Printer

NewPrinter creates a message.Printer for the Locale

Directories

Path Synopsis
store module
gotextstore Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL