locale

package
v0.0.0-...-49e4307 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2021 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect(l *Localizer) func(next http.Handler) http.Handler

Detect is a middleware that sets the locale based on the Accept-Language header if not already set.

func Set

Types

type Locale

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

func Get

func Get(c context.Context) *Locale

func (*Locale) LanguageName

func (l *Locale) LanguageName(code string) string

func (*Locale) T

func (l *Locale) T(scope, key string, args ...interface{}) string

func (*Locale) Translate

func (l *Locale) Translate(scope, key string, args ...interface{}) string

type Localizer

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

func NewLocalizer

func NewLocalizer(langs ...string) *Localizer

func (*Localizer) DefaultLocale

func (l *Localizer) DefaultLocale() *Locale

func (*Localizer) GetLocale

func (l *Localizer) GetLocale(langs ...string) *Locale

func (*Localizer) Locales

func (l *Localizer) Locales() []*Locale

Jump to

Keyboard shortcuts

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