localizer

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ContextKey string = "phx_localization"

Variables

This section is empty.

Functions

func CreateCookie

func CreateCookie(w http.ResponseWriter, localization string, cy core.Cypher) error

func ReadCookie

func ReadCookie(req *http.Request, cy core.Cypher) (string, error)

Types

type Localizer

type Localizer map[string]string

func (Localizer) Get

func (loc Localizer) Get(key string) string

type LocalizerStore

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

func NewLocalizerStore

func NewLocalizerStore(files embed.FS, sharedKey, errorsKey string, cypher core.Cypher) LocalizerStore

func (LocalizerStore) CreateCookie added in v0.0.44

func (ls LocalizerStore) CreateCookie(w http.ResponseWriter, localization string)

func (LocalizerStore) Get

func (ls LocalizerStore) Get(key, language string) Localizer

func (LocalizerStore) GetLocalizedError

func (ls LocalizerStore) GetLocalizedError(err core.UseCaseError, req *http.Request) string

func (LocalizerStore) GetUsingRequest

func (ls LocalizerStore) GetUsingRequest(key string, req *http.Request) Localizer

func (LocalizerStore) GetUsingRequestWithoutShared

func (ls LocalizerStore) GetUsingRequestWithoutShared(key string, req *http.Request) Localizer

func (LocalizerStore) GetWithoutShared

func (ls LocalizerStore) GetWithoutShared(key, language string) Localizer

func (LocalizerStore) LoadIntoField

func (ls LocalizerStore) LoadIntoField(field **Localizer, key string, language string)

func (LocalizerStore) LoadIntoFieldUsingRequest

func (ls LocalizerStore) LoadIntoFieldUsingRequest(field **Localizer, key string, req *http.Request)

func (LocalizerStore) ReadCookie added in v0.0.44

func (ls LocalizerStore) ReadCookie(req *http.Request) string

Jump to

Keyboard shortcuts

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