view

package
v0.0.0-...-0ad18f3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Parse all templates once and make them globally available

Index

Constants

View Source
const DEFAULT_LANGUAGE = "en"
View Source
const DEFAULT_TRANSLATIONS_FILE = "allInOne.csv"

Variables

This section is empty.

Functions

func AddDict

func AddDict(dict map[string]interface{}, values ...interface{}) (map[string]interface{}, error)

function AddDict adds more key/value pairs to a dictionary. This helps to break long parameter lists to templates on several lines to make them better readable

func Concat

func Concat(s ...interface{}) string

function Concat cocatenates the string representations of its parameters

func Dict

func Dict(values ...interface{}) (map[string]interface{}, error)

Function Dict creates a map from its inputs for use in go templates thanks to stackoverflow user tux21b

func ExpandTemplate

func ExpandTemplate(key, lang string, values map[string]interface{}) string

func GetTranslation

func GetTranslation(key, lang string) string

func GetTranslations

func GetTranslations(lang string) map[string]string

func GetTrtemplate

func GetTrtemplate(key, lang string) *template.Template

func GetTrtemplates

func GetTrtemplates(lang string) map[string]*template.Template

func I18n

func I18n(key, lang string, values ...map[string]interface{}) string

func IsKind

func IsKind(obj interface{}, kind string) bool

function IsKind tests an object obj for a given reflect.Kind

func IsMod

func IsMod(val, mod int) bool

func LanguagesI18n

func LanguagesI18n(lang string) map[model.Lang]string

func MergeDict

func MergeDict(dict map[string]interface{}, more ...map[string]interface{}) (map[string]interface{}, error)

function MergeDict merges dictionaries for use in templates into a new dictionary

func OblastsI18n

func OblastsI18n(lang string) []model.Oblast

func PreferedLanguages

func PreferedLanguages(r *http.Request) []string

extract languages with q >= 0.5 from HTTP language header

func ReadTranslations

func ReadTranslations(file string)

func SafeAtt

func SafeAtt(s interface{}) template.HTMLAttr

function SaveAtt flags the string representation of an interface parameter as a safe html attribute

func Templates

func Templates() *template.Template

func Views

func Views() *template.Template

Types

This section is empty.

Jump to

Keyboard shortcuts

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