locale

package
v2.2.13 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AvailableLanguages = map[string]string{
	"de_DE":            "Deutsch",
	"el_EL":            "Ελληνικά",
	"en_US":            "English",
	"es_ES":            "Español",
	"fi_FI":            "Suomi",
	"fr_FR":            "Français",
	"hi_IN":            "हिन्दी",
	"id_ID":            "Bahasa Indonesia",
	"it_IT":            "Italiano",
	"ja_JP":            "日本語",
	"nan_Latn_pehoeji": "Pe̍h-ōe-jī",
	"nl_NL":            "Nederlands",
	"pl_PL":            "Polski",
	"pt_BR":            "Português Brasileiro",
	"ro_RO":            "Română",
	"ru_RU":            "Русский",
	"tr_TR":            "Türkçe",
	"uk_UA":            "Українська",
	"zh_CN":            "简体中文",
	"zh_TW":            "繁體中文",
}

AvailableLanguages is the list of available languages.

Functions

This section is empty.

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 instance for the given language.

func (*Printer) Plural

func (p *Printer) Plural(key string, n int, args ...any) 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 ...any) 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