HUGO

.WordCount & .ReadingTime don't work in russian i18n

I have a theme with several i18n string translations. If i set defaultContentLanguage to “ru” or “ru-ru” (Russian) then instead of numbers i see just strings ‘wordCount’ and ‘readingTime’.

Hugo version 0.55.5.

config.toml
defaultContentLanguage = "ru"

i18n/ru.yaml

    wordCount:
      one: "{{ .Count }} слово"
      other: "{{ .Count }} слов"

    readingTime:
      one: "{{ .Count }} минута чтения"
      other: "{{ .Count }} минут чтения"

layout

    <span class="more-meta"> {{ T "wordCount" .WordCount }} </span>
    <span class="more-meta"> {{ T "readingTime" .ReadingTime }} </span>

If i set defaultContentLanguage to “rus” (according to this issue) it begins to work. Actually any string in this field will work if i have that [any string].yaml in the i18n folder. But in this case i cannot use the correct russian translation of plurals (one, few, many like in this article, part “A final world”) because go-i18n needs proper language code.

2 Likes