localizer

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Aug 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 Store added in v0.5.0

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

func NewLocalizerStore

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

func (Store) CreateCookie added in v0.5.0

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

func (Store) Get added in v0.5.0

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

func (Store) GetLocalizedError added in v0.5.0

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

func (Store) GetUsingRequest added in v0.5.0

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

func (Store) GetUsingRequestWithoutShared added in v0.5.0

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

func (Store) GetWithoutShared added in v0.5.0

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

func (Store) LoadIntoField added in v0.5.0

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

func (Store) LoadIntoFieldUsingRequest added in v0.5.0

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

func (Store) ReadCookie added in v0.5.0

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

Jump to

Keyboard shortcuts

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