Documentation ¶
Overview ¶
Parse all templates once and make them globally available
Index ¶
- Constants
- func AddDict(dict map[string]interface{}, values ...interface{}) (map[string]interface{}, error)
- func Concat(s ...interface{}) string
- func Dict(values ...interface{}) (map[string]interface{}, error)
- func ExpandTemplate(key, lang string, values map[string]interface{}) string
- func GetTranslation(key, lang string) string
- func GetTranslations(lang string) map[string]string
- func GetTrtemplate(key, lang string) *template.Template
- func GetTrtemplates(lang string) map[string]*template.Template
- func I18n(key, lang string, values ...map[string]interface{}) string
- func IsKind(obj interface{}, kind string) bool
- func IsMod(val, mod int) bool
- func LanguagesI18n(lang string) map[model.Lang]string
- func MergeDict(dict map[string]interface{}, more ...map[string]interface{}) (map[string]interface{}, error)
- func OblastsI18n(lang string) []model.Oblast
- func PreferedLanguages(r *http.Request) []string
- func ReadTranslations(file string)
- func SafeAtt(s interface{}) template.HTMLAttr
- func Templates() *template.Template
- func Views() *template.Template
Constants ¶
View Source
const DEFAULT_LANGUAGE = "en"
View Source
const DEFAULT_TRANSLATIONS_FILE = "allInOne.csv"
Variables ¶
This section is empty.
Functions ¶
func AddDict ¶
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 ¶
Function Dict creates a map from its inputs for use in go templates thanks to stackoverflow user tux21b
func ExpandTemplate ¶
func GetTranslation ¶
func GetTranslations ¶
func GetTrtemplate ¶
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 PreferedLanguages ¶
extract languages with q >= 0.5 from HTTP language header
func ReadTranslations ¶
func ReadTranslations(file string)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.