Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/locales.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/locale_map.tmpl')
-rw-r--r--cmd/locale_map.tmpl34
1 files changed, 34 insertions, 0 deletions
diff --git a/cmd/locale_map.tmpl b/cmd/locale_map.tmpl
new file mode 100644
index 00000000..d3e0db56
--- /dev/null
+++ b/cmd/locale_map.tmpl
@@ -0,0 +1,34 @@
+{{ 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 }} \ No newline at end of file