summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2018-02-21 12:06:58 +0100
committerRuben Pollan <meskio@sindominio.net>2018-02-21 15:46:21 +0100
commit868b796e77146e259c36789666282007cf80cc9b (patch)
treea6847eec043757fd4a386ec19002ca1fad1d7966 /main.go
parente843f609fcedc9d5bc15c762429bca9cc3c3f8b0 (diff)
[feat] add i18n support
Using golang.org/x/text, wich is still in early stages of development, but seems to work good enough for our needs. - Resolves: #2
Diffstat (limited to 'main.go')
-rw-r--r--main.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/main.go b/main.go
index e1b2a56..d483c26 100644
--- a/main.go
+++ b/main.go
@@ -19,17 +19,22 @@ import (
"log"
"0xacab.org/leap/bitmask-systray/bitmask"
+ "github.com/jmshal/go-locale"
+ "golang.org/x/text/message"
)
const (
provider = "riseup.net"
)
+var printer *message.Printer
+
func main() {
conf, err := parseConfig()
if err != nil {
log.Fatal(err)
}
+ initPrinter()
notify := newNotificator(conf)
@@ -60,3 +65,12 @@ func checkAndInstallHelpers(b *bitmask.Bitmask, notify *notificator) {
}
}
}
+
+func initPrinter() {
+ locale, err := go_locale.DetectLocale()
+ if err != nil {
+ log.Println("Error detecting the system locale: ", err)
+ }
+
+ printer = message.NewPrinter(message.MatchLanguage(locale, "en"))
+}