Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'langs/i18n/i18n.go')
-rw-r--r--langs/i18n/i18n.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/langs/i18n/i18n.go b/langs/i18n/i18n.go
index 922b06367..83144b89c 100644
--- a/langs/i18n/i18n.go
+++ b/langs/i18n/i18n.go
@@ -74,19 +74,24 @@ func (t Translator) initFuncs(bndl *i18n.Bundle) {
t.translateFuncs[currentLangKey] = func(translationID string, templateData interface{}) string {
+ var pluralCount interface{}
+
if templateData != nil {
tp := reflect.TypeOf(templateData)
if hreflect.IsNumber(tp.Kind()) {
+ pluralCount = templateData
// This was how go-i18n worked in v1.
templateData = map[string]interface{}{
"Count": templateData,
}
+
}
}
translated, translatedLang, err := localizer.LocalizeWithTag(&i18n.LocalizeConfig{
MessageID: translationID,
TemplateData: templateData,
+ PluralCount: pluralCount,
})
if err == nil && currentLang == translatedLang {