summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorMark Kopenga <mkopenga@gmail.com>2018-08-14 12:52:26 +0200
committerMark Kopenga <mkopenga@gmail.com>2018-08-14 12:52:26 +0200
commit0c39347224335998fd38cdad2feb23f55d3a5516 (patch)
tree616beaf77f73924786027fe7984c09ac9f5e7a78 /pkg
parentdd7e93ac8d5c169959fbeade89fcd59bfae49fe8 (diff)
Added auto detection for the system language
Diffstat (limited to 'pkg')
-rw-r--r--pkg/gui/files_panel.go2
-rw-r--r--pkg/i18n/dutch.go5
-rw-r--r--pkg/i18n/i18n.go10
3 files changed, 9 insertions, 8 deletions
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index ad8ee6fbc..ba60a3278 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -168,7 +168,7 @@ func (gui *Gui) renderfilesOptions(g *gocui.Gui, file *commands.File) error {
return gui.renderOptionsMap(g, optionsMap)
}
if file.Tracked {
- optionsMap["d"] = "checkout"
+ optionsMap["d"] = lang.SLocalize("checkout", "checkout")
}
return gui.renderOptionsMap(g, optionsMap)
}
diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go
index 9a847b573..10d01c6df 100644
--- a/pkg/i18n/dutch.go
+++ b/pkg/i18n/dutch.go
@@ -6,7 +6,7 @@ import (
)
func addDutch(i18nObject *i18n.Bundle) *i18n.Bundle {
- i18nObject.AddMessages(language.English,
+ i18nObject.AddMessages(language.Dutch,
&i18n.Message{
ID: "NotEnoughSpace",
Other: "Niet genoeg ruimte om de panelen te renderen",
@@ -70,6 +70,9 @@ func addDutch(i18nObject *i18n.Bundle) *i18n.Bundle {
}, &i18n.Message{
ID: "resolveMergeConflicts",
Other: "verhelp samenvoegen fouten",
+ }, &i18n.Message{
+ ID: "checkout",
+ Other: "uitchecken",
},
)
return i18nObject
diff --git a/pkg/i18n/i18n.go b/pkg/i18n/i18n.go
index c743218f8..ffd77fde6 100644
--- a/pkg/i18n/i18n.go
+++ b/pkg/i18n/i18n.go
@@ -1,7 +1,7 @@
package lang
import (
- "github.com/BurntSushi/toml"
+ "github.com/cloudfoundry/jibber_jabber"
"github.com/nicksnyder/go-i18n/v2/i18n"
"golang.org/x/text/language"
)
@@ -9,15 +9,13 @@ import (
// the function to setup the localizer
func getlocalizer() *i18n.Localizer {
- // TODO: currently the system language issn't detected
- // I'm not sure how to detect it
- var i18nObject = &i18n.Bundle{DefaultLanguage: language.Dutch}
- i18nObject.RegisterUnmarshalFunc("toml", toml.Unmarshal)
+ userLang, _ := jibber_jabber.DetectLanguage()
+ var i18nObject = &i18n.Bundle{DefaultLanguage: language.English}
// add translation file(s)
i18nObject = addDutch(i18nObject)
- return i18n.NewLocalizer(i18nObject)
+ return i18n.NewLocalizer(i18nObject, userLang)
}
// setup the localizer for later use