locale_map.tmpl
551 Bytes
{{ define "localeslist" }}
package localeslist
import (
"sync"
)
// LocaleFunc is the function to run in order to create
// a new instance of a given locale
type LocaleFunc func() locales.Translator
// LocaleMap is map of locale string to instance function
type LocaleMap map[string]LocaleFunc
var (
once sync.Once
localeMap LocaleMap
)
func init() {
once.Do(func(){
localeMap = map[string]LocaleFunc{
{{ . }}
}
})
}
// Map returns the map of locales to instance New function
func Map() LocaleMap {
return localeMap
}
{{ end }}