Hugo

Since I’ve started localization talk, this note will be devoted to localization. To be honest, I’m not sure since what version this happened, but localization in Hugo has greatly stepped forward.

First, Hugo now natively supports plurals for many languages. All thanks to https://github.com/gohugoio/go-i18n module (fork of https://github.com/nicksnyder/go-i18n ). Usage is very simple: create reqired keys in localization file and translate them. Here’s current list for reference (with two-letter language codes): https://github.com/gohugoio/go-i18n/blob/main/v2/internal/plural/codegen/plurals.xml

Second, Hugo can now localize dates through time.Format DATE_FORMAT DATE. I’ve rewritten templates a little, and now places with dates from these:

{{- with .Site.Params.dateformat | default "2006-01-02" | .PublishDate.Format -}}

became these:

{{- with time.Format (.Site.Params.dateformat | default "2006-01-02") .PublishDate -}}

Category and meta tags localization I had to done on my own. They may not fully work with new section though, but I’ll fix it sometime.