diff options
Diffstat (limited to 'pkg/i18n/i18n.go')
-rw-r--r-- | pkg/i18n/i18n.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/i18n/i18n.go b/pkg/i18n/i18n.go index f54cb9d80..5a09d6d66 100644 --- a/pkg/i18n/i18n.go +++ b/pkg/i18n/i18n.go @@ -60,6 +60,17 @@ func (l *Localizer) SLocalize(ID string, Other string) string { }) } +// TemplateLocalize allows the Other input to be dynamic +func (l *Localizer) TemplateLocalize(ID string, Other string, TemplateData map[string]interface{}) string { + return l.Localize(&i18n.LocalizeConfig{ + DefaultMessage: &i18n.Message{ + ID: ID, + Other: Other, + }, + TemplateData: TemplateData, + }) +} + // GetLanguage returns the currently selected language, e.g 'en' func (l *Localizer) GetLanguage() string { return l.language |