...
1{{ define "localeslist" }}
2package localeslist
3
4import (
5 "sync"
6)
7
8// LocaleFunc is the function to run in order to create
9// a new instance of a given locale
10type LocaleFunc func() locales.Translator
11
12// LocaleMap is map of locale string to instance function
13type LocaleMap map[string]LocaleFunc
14
15
16var (
17 once sync.Once
18 localeMap LocaleMap
19)
20
21func init() {
22 once.Do(func(){
23 localeMap = map[string]LocaleFunc{
24 {{ . }}
25 }
26 })
27}
28
29// Map returns the map of locales to instance New function
30func Map() LocaleMap {
31 return localeMap
32}
33
34{{ end }}
View as plain text