From 6e518142b48f70fc63b0c72d00754733accd23f2 Mon Sep 17 00:00:00 2001 From: Mark Kopenga Date: Tue, 14 Aug 2018 12:56:11 +0200 Subject: [PATCH] added some commands --- pkg/i18n/dutch.go | 5 +++++ pkg/i18n/i18n.go | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index 10d01c6df..12cbc8f43 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -5,7 +5,10 @@ import ( "golang.org/x/text/language" ) +// addDutch will add all the translations func addDutch(i18nObject *i18n.Bundle) *i18n.Bundle { + + // add the translations i18nObject.AddMessages(language.Dutch, &i18n.Message{ ID: "NotEnoughSpace", @@ -75,5 +78,7 @@ func addDutch(i18nObject *i18n.Bundle) *i18n.Bundle { Other: "uitchecken", }, ) + + // return the new i18nObject return i18nObject } diff --git a/pkg/i18n/i18n.go b/pkg/i18n/i18n.go index ffd77fde6..a62f50c1e 100644 --- a/pkg/i18n/i18n.go +++ b/pkg/i18n/i18n.go @@ -9,12 +9,16 @@ import ( // the function to setup the localizer func getlocalizer() *i18n.Localizer { + // detect the user's language userLang, _ := jibber_jabber.DetectLanguage() + + // create a i18n bundle that can be used to add translations and other things var i18nObject = &i18n.Bundle{DefaultLanguage: language.English} // add translation file(s) i18nObject = addDutch(i18nObject) + // return the new localizer that can be used to translate text return i18n.NewLocalizer(i18nObject, userLang) }