locale

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvailableLanguages

func AvailableLanguages() map[string]string

AvailableLanguages returns the list of available languages.

func LoadCatalogMessages

func LoadCatalogMessages() error

LoadCatalogMessages loads and parses all translations encoded in JSON.

Types

type LocalizedError added in v2.0.51

type LocalizedError struct {
	// contains filtered or unexported fields
}

func NewLocalizedError added in v2.0.51

func NewLocalizedError(translationKey string, translationArgs ...any) *LocalizedError

func (*LocalizedError) Error added in v2.0.51

func (v *LocalizedError) Error() error

func (*LocalizedError) String added in v2.0.51

func (v *LocalizedError) String() string

func (*LocalizedError) Translate added in v2.0.51

func (v *LocalizedError) Translate(language string) string

type LocalizedErrorWrapper added in v2.0.51

type LocalizedErrorWrapper struct {
	// contains filtered or unexported fields
}

func NewLocalizedErrorWrapper added in v2.0.51

func NewLocalizedErrorWrapper(originalErr error, translationKey string, translationArgs ...any) *LocalizedErrorWrapper

func (*LocalizedErrorWrapper) Error added in v2.0.51

func (l *LocalizedErrorWrapper) Error() error

func (*LocalizedErrorWrapper) Translate added in v2.0.51

func (l *LocalizedErrorWrapper) Translate(language string) string

type Printer

type Printer struct {
	// contains filtered or unexported fields
}

Printer converts translation keys to language-specific strings.

func NewPrinter

func NewPrinter(language string) *Printer

NewPrinter creates a new Printer.

func (*Printer) Plural

func (p *Printer) Plural(key string, n int, args ...interface{}) string

Plural returns the translation of the given key by using the language plural form.

func (*Printer) Print added in v2.1.1

func (p *Printer) Print(key string) string

func (*Printer) Printf

func (p *Printer) Printf(key string, args ...interface{}) string

Printf is like fmt.Printf, but using language-specific formatting.

Jump to

Keyboard shortcuts

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