From 6fd328ddaa61cd75c24cd2d9b8fdc0f73c7ab974 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 22 Jan 2016 01:37:11 -0300 Subject: Refactoring api to use translations (chunk 2) - Add spanish translations - Does not include tests - Add func to get the translations for a user locale --- utils/i18n.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'utils/i18n.go') diff --git a/utils/i18n.go b/utils/i18n.go index 4b7b187a8..6811796fd 100644 --- a/utils/i18n.go +++ b/utils/i18n.go @@ -57,6 +57,15 @@ func GetTranslationsBySystemLocale() i18n.TranslateFunc { return translations } +func GetUserTranslations(locale string) i18n.TranslateFunc { + if _, ok := locales[locale]; !ok { + locale = model.DEFAULT_LOCALE + } + + translations, _ := i18n.Tfunc(locale) + return translations +} + func SetTranslations(locale string) i18n.TranslateFunc { translations, _ := i18n.Tfunc(locale) return translations -- cgit v1.2.3-1-g7c22