language

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMessageFallback = errors.New("translation message fallback to default language")
)

Functions

func InitTranslation

func InitTranslation(c BundleCfg)

func IsMessageFallbackErr

func IsMessageFallbackErr(err error) bool

func IsMessageNotFoundErr

func IsMessageNotFoundErr(err error) bool

func ReloadTranslation

func ReloadTranslation() bool

func T

func T(msgID string, tplData ...map[any]any) string

Types

type BundleCfg

type BundleCfg struct {
	DefaultLanguage language.Tag
	Language        language.Tag
	LanguagePaths   []string
}

type Translation

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

func NewTranslation

func NewTranslation(c BundleCfg) *Translation

func (*Translation) LoadTranslation

func (t *Translation) LoadTranslation(c BundleCfg)

func (*Translation) ReloadTranslation

func (t *Translation) ReloadTranslation()

func (*Translation) Translate

func (t *Translation) Translate(lng language.Tag, msgID string, tplData ...map[any]any) (string, error)

Translate message.

Jump to

Keyboard shortcuts

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