core

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddContext

func AddContext(c echo.Context) gobwebs.Map

AddContext will add the echo.Context into the template namespace

func GetDefaultLang

func GetDefaultLang() string

GetDefaultLang returns the server set DefaultLang

func GetGlobalLocalizer

func GetGlobalLocalizer(lang string) *localizer.Localizer

GetGlobalLocalizer fetches a Localizer for given language using the default global language catalog

func GetLang

func GetLang(c echo.Context) string

GetLang sets language in the users session

func GetLocalizer

func GetLocalizer(lang string) (*localizer.Localizer, bool)

GetLocalizer fetches a Localizer for given language using the Gatalog (gobwebs specific) language catalog

func GetSessionGlobalLocalizer

func GetSessionGlobalLocalizer(c echo.Context) *localizer.Localizer

GetSessionGlobalLocalizer fetches Localizer for language stored in user session. If no language is set, or found, it defaults to English (en). This will return a Localizer using the message.DefaultCatalog catalog.

func GetSessionLocalizer

func GetSessionLocalizer(c echo.Context) *localizer.Localizer

GetSessionLocalizer fetches Localizer for language stored in user session. If no language is set, or found, it defaults to English (en). This will return a Localizer using the Gatalog gobwebs catalog

func LoadMessages

func LoadMessages(c echo.Context) gobwebs.Map

LoadMessages loads all session flash messages into template data context under the variable name `messages`

func SetLang

func SetLang(c echo.Context, lang string) error

SetLang sets language in the users session

func StripHtmlTags

func StripHtmlTags(blob string) string

StripHtmlTags helper function strip all <> tags from a string. For more features/control use something like the bluemonday module. Adapted from the following SO answer: https://stackoverflow.com/a/64701836

Types

type PageData

type PageData struct {
	Title string
	Data  map[string]string
}

PageData holds translations for html template values

func NewPageData

func NewPageData(title string) *PageData

NewPageData returns a new PageData instance

Jump to

Keyboard shortcuts

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