renderer

package
v1.87.5 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TranslateFn = "t"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Renderer

type Renderer struct {
	Templates map[string]*template.Template
	// contains filtered or unexported fields
}

func NewRenderer

func NewRenderer(dir http.FileSystem, tmplMapping map[string]string, funcs map[string]interface{}, translatorConfig i18n.TranslatorConfig) (*Renderer, error)

func (*Renderer) AddMessages

func (r *Renderer) AddMessages(translator *i18n.Translator, tag language.Tag, messages ...i18n.Message) error

func (*Renderer) Localize

func (r *Renderer) Localize(translator *i18n.Translator, id string, args map[string]interface{}) string

func (*Renderer) LocalizeFromRequest

func (r *Renderer) LocalizeFromRequest(translator *i18n.Translator, req *http.Request, id string, args map[string]interface{}) string

func (*Renderer) NewTranslator

func (r *Renderer) NewTranslator() (*i18n.Translator, error)

func (*Renderer) RenderTemplate

func (r *Renderer) RenderTemplate(w http.ResponseWriter, req *http.Request, translator *i18n.Translator, tmpl *template.Template, data interface{}, reqFuncs map[string]interface{})

func (*Renderer) ReqLang

func (r *Renderer) ReqLang(translator *i18n.Translator, req *http.Request) language.Tag

Jump to

Keyboard shortcuts

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