i18n

package
v1.5.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Languages = map[string]string{
	"zh_CN": "简体中文",
	"zh_TW": "繁體中文",
	"en_US": "English",
	"es_ES": "Español",
	"de_DE": "Deutsch",
}
View Source
var Translations embed.FS

Functions

This section is empty.

Types

type Localizer

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

func NewLocalizer

func NewLocalizer(lang, domain, path string, data any) *Localizer

func (*Localizer) AppendIntl

func (l *Localizer) AppendIntl(lang, domain, path string, data any)

func (*Localizer) ErrorT

func (l *Localizer) ErrorT(defaultValue string, args ...any) error

ErrorT produces an error with a translated error string. Substitution is performed via the `T` function above, following the same rules.

func (*Localizer) Exists

func (l *Localizer) Exists(lang string) bool

func (*Localizer) N

func (l *Localizer) N(orig string, args ...int) string

N translates a string, possibly substituting arguments into it along the way. If len(args) is > 0, args1 is assumed to be the plural value and plural translation is used.

func (*Localizer) SetLanguage

func (l *Localizer) SetLanguage(lang string)

func (*Localizer) T

func (l *Localizer) T(orig string) string

func (*Localizer) Tf

func (l *Localizer) Tf(defaultValue string, args ...any) string

Jump to

Keyboard shortcuts

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