diff options
author | Mark Kopenga <mkopenga@gmail.com> | 2018-08-14 12:52:26 +0200 |
---|---|---|
committer | Mark Kopenga <mkopenga@gmail.com> | 2018-08-14 12:52:26 +0200 |
commit | 0c39347224335998fd38cdad2feb23f55d3a5516 (patch) | |
tree | 616beaf77f73924786027fe7984c09ac9f5e7a78 /pkg/i18n/i18n.go | |
parent | dd7e93ac8d5c169959fbeade89fcd59bfae49fe8 (diff) |
Added auto detection for the system language
Diffstat (limited to 'pkg/i18n/i18n.go')
-rw-r--r-- | pkg/i18n/i18n.go | 10 |
1 files changed, 4 insertions, 6 deletions
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 |