localizer

package
v0.0.0-...-0d6871a Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Matcher will return the first supported language from the give language tags.
	Matcher = language.NewMatcher([]language.Tag{language.English, language.Norwegian})
)

Functions

func SetDefaultLocale

func SetDefaultLocale(lang language.Tag)

SetDefaltLocale sets the defaul locale. It will panic if the given tag is not among locales. It is not safe for concurrent use, and should be set once at program startup.

Types

type Localizer

type Localizer struct {
	Lang language.Tag
	// contains filtered or unexported fields
}

func Get

func Get(lang language.Tag) Localizer

func GetFromAcceptLang

func GetFromAcceptLang(lang string) Localizer

GetFromAccept lang returns a Localizer parsed from the given Accept-language header string.

func (Localizer) Translate

func (l Localizer) Translate(key message.Reference, args ...any) string

Jump to

Keyboard shortcuts

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