localeDefault

package
v0.0.0-...-dd0c161 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func InlineTemplate

func InlineTemplate(templ string) *template.Template

InlineTemplate creates a template from the string passed to it

func LoadTemplate

func LoadTemplate(names ...string) *template.Template

LoadTemplate concatenates templates from bindata

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type DefaultTranslations

type DefaultTranslations struct {
	CompanyName            string
	CompanyWebsite         string
	LogoURL                string
	Locales                map[string]Translation
	DefaultLanguage        string
	UserVerifyEmailAddress string
	ResetPasswordAddress   string
}

DefaultTranslations uses some predefined translations and templates for waechter

func NewDefaultTranslations

func NewDefaultTranslations() *DefaultTranslations

NewDefaultTranslations creates a new DefaultTranslation and loads en and de locales

func (*DefaultTranslations) GetDefaultLanguage

func (def *DefaultTranslations) GetDefaultLanguage() string

GetDefaultLanguage returns the default lang code

func (*DefaultTranslations) GetForgotPasswordEmail

func (def *DefaultTranslations) GetForgotPasswordEmail(user *waechter.User, passwordToken string) (*waechter.Email, error)

GetForgotPasswordEmail sends an email to the user with a link to reset their password

func (*DefaultTranslations) GetLanguages

func (def *DefaultTranslations) GetLanguages() []string

GetLanguages retrieves all available langauges

func (*DefaultTranslations) GetPasswordResetEmail

func (def *DefaultTranslations) GetPasswordResetEmail(user *waechter.User) (*waechter.Email, error)

GetPasswordResetEmail return an email object for the notification of a reset password

func (*DefaultTranslations) GetRegistrationEmail

func (def *DefaultTranslations) GetRegistrationEmail(user *waechter.User, verificationToken string) (*waechter.Email, error)

GetRegistrationEmail returns an email struct for a new user

func (*DefaultTranslations) GetTranslation

func (def *DefaultTranslations) GetTranslation(lang string) Translation

GetTranslation returns a *Translation according to the language code passed. Returns the default translation if its unknown

func (*DefaultTranslations) LoadLocale

func (def *DefaultTranslations) LoadLocale(langCode string, translation Translation)

LoadLocale registers a new translation

type Translation

type Translation map[string]*template.Template

Translation is a map of locale identifiers and templates

type TranslationParameters

type TranslationParameters map[string]interface{}

TranslationParameters contain parameters passed to a template

Jump to

Keyboard shortcuts

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