From 4d23da8c389d210c5d067fdbcb28d6875797e9e6 Mon Sep 17 00:00:00 2001 From: nytpu Date: Tue, 11 May 2021 11:16:36 -0600 Subject: [PATCH] add core.Localizer --- comitium.go | 2 +- core/core.go | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/comitium.go b/comitium.go index 681b6fb..6ab845f 100644 --- a/comitium.go +++ b/comitium.go @@ -56,7 +56,7 @@ func main() { // make sure it exists so we can start working with files in it os.MkdirAll(dataPath, os.ModePerm) - err := core.Init(dataPath) + err := core.Init(dataPath, localizer) if err != nil { fmt.Fprintf(os.Stderr, "Error in initialization: %v\n", err) os.Exit(1) diff --git a/core/core.go b/core/core.go index 71738a8..d35f9bf 100644 --- a/core/core.go +++ b/core/core.go @@ -19,6 +19,8 @@ import ( "os" "path/filepath" "sync" + + "golang.nytpu.com/comitium/localizations" ) // Global instance of FullData @@ -35,9 +37,13 @@ var Header string // Timeout for requests var Timeout int +var Localizer *localizations.Localizer + // have to do this instead of the automatically called init() because // initialization stuff requires parsing of command line args first -func Init(dataPath string) error { +func Init(dataPath string, localizer *localizations.Localizer) error { + Localizer = localizer + // initialize comitium.json & data maps f, err := os.Open(filepath.Join(dataPath, "comitium.json")) if err == nil {