i18n

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Localizer

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

Localizer is a wrapper around i18n.Localizer with a better API.

func NewLocalizer

func NewLocalizer(defaultLang language.Tag, messagesMap map[string][]byte) (*Localizer, error)

NewLocalizer creates a new Localizer from map with a key as filename and value as its content in toml format. Filename should satisfy the pattern <domain/description>.<language>.toml.

func (*Localizer) Localize

func (l *Localizer) Localize(msgID string, params ...map[string]interface{}) string

Localize returns localized string for default language.

func (*Localizer) LocalizeFor

func (l *Localizer) LocalizeFor(lang language.Tag, msgID string, params ...map[string]interface{}) string

LocalizeFor returns localized string for specified language.

Jump to

Keyboard shortcuts

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