Make Locale and Po objects serializable. Closes #23

This commit is contained in:
Leonel Quinteros
2018-09-07 18:14:38 -03:00
parent 302c88af99
commit 4cbf30d337
8 changed files with 303 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ For quick/simple translations you can use the package level functions directly.
package gotext
import (
"encoding/gob"
"sync"
)
@@ -45,14 +46,17 @@ type config struct {
var globalConfig *config
// Init default configuration
func init() {
// Init default configuration
globalConfig = &config{
domain: "default",
language: "en_US",
library: "/usr/local/share/locale",
storage: nil,
}
// Register Translator types for gob encoding
gob.Register(TranslatorEncoding{})
}
// loadStorage creates a new Locale object at package level based on the Global variables settings.