add core.Localizer
This commit is contained in:
+1
-1
@@ -56,7 +56,7 @@ func main() {
|
|||||||
// make sure it exists so we can start working with files in it
|
// make sure it exists so we can start working with files in it
|
||||||
os.MkdirAll(dataPath, os.ModePerm)
|
os.MkdirAll(dataPath, os.ModePerm)
|
||||||
|
|
||||||
err := core.Init(dataPath)
|
err := core.Init(dataPath, localizer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Error in initialization: %v\n", err)
|
fmt.Fprintf(os.Stderr, "Error in initialization: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|||||||
+7
-1
@@ -19,6 +19,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"golang.nytpu.com/comitium/localizations"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Global instance of FullData
|
// Global instance of FullData
|
||||||
@@ -35,9 +37,13 @@ var Header string
|
|||||||
// Timeout for requests
|
// Timeout for requests
|
||||||
var Timeout int
|
var Timeout int
|
||||||
|
|
||||||
|
var Localizer *localizations.Localizer
|
||||||
|
|
||||||
// have to do this instead of the automatically called init() because
|
// have to do this instead of the automatically called init() because
|
||||||
// initialization stuff requires parsing of command line args first
|
// 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
|
// initialize comitium.json & data maps
|
||||||
f, err := os.Open(filepath.Join(dataPath, "comitium.json"))
|
f, err := os.Open(filepath.Join(dataPath, "comitium.json"))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user