Documentation ¶
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func InlineTemplate(templ string) *template.Template
- func LoadTemplate(names ...string) *template.Template
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type DefaultTranslations
- func (def *DefaultTranslations) GetDefaultLanguage() string
- func (def *DefaultTranslations) GetForgotPasswordEmail(user *waechter.User, passwordToken string) (*waechter.Email, error)
- func (def *DefaultTranslations) GetLanguages() []string
- func (def *DefaultTranslations) GetPasswordResetEmail(user *waechter.User) (*waechter.Email, error)
- func (def *DefaultTranslations) GetRegistrationEmail(user *waechter.User, verificationToken string) (*waechter.Email, error)
- func (def *DefaultTranslations) GetTranslation(lang string) Translation
- func (def *DefaultTranslations) LoadLocale(langCode string, translation Translation)
- type Translation
- type TranslationParameters
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
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 ¶
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 ¶
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 InlineTemplate ¶
InlineTemplate creates a template from the string passed to it
func LoadTemplate ¶
LoadTemplate concatenates templates from bindata
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
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 ¶
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 ¶
Translation is a map of locale identifiers and templates
type TranslationParameters ¶
type TranslationParameters map[string]interface{}
TranslationParameters contain parameters passed to a template