0.76.0: i18n gone wrong?

Release notes for 0.76.0 say go-i18n has been updated to v2. I have skimmed through go-i18n docs, but the API seems to look the same and

[readingTime]
one = "One minute to read"
other = "{{ .Count }} minutes to read"

is supposed to work. However, where 0.75.1 produces “One minute to read”, 0.76.0 produces “1 minutes to read” with all the same site.

I spent 2 years doing that upgrade (:-

1 Like

Sorry, I don’t mean to say you did something wrong. Perhaps I have a mistake somewhere, so I’m asking here on the forum instead of rushing to GitHub to raise a bugreport :wink:

Thing is, I have {{ T "readingTime" .ReadingTime }} in my template, and with the i18n/en.toml above I don’t get the results I used to get before.

If things have changed so that I need to change something in my templates, that’s OK, I’m willing to do what’s needed, I just need to figure out what it is exactly. If, however, it’s still supposed to work — well, then it’s a regression, sorry, man.

I assume it’s a bug, my comment was just self-irony.

Guessed as much. Still, I know how that feels, so I’m really sorry to be the messenger that brought the news.

I can confirm that this is a bug; odd we did not have a test for this. Seems that he has added a PluralCount to the API … I have pushed a PR to fix it. Will push a release tomorrow. Sorry for the noise.

3 Likes

This is actually awesome and thank you so very much!

I’ve been playing with the fixed version for the last hour, and I can have proper numerals in Russian now — wow! I thought it wasn’t possible at all :slight_smile:

Russian numerals are funny. We have 3 forms for the nouns:
1 минута (minute) — singular
2 минуты — plural/few, for 2, 3 or 4
5 минут — plural/many, for 5–20
which wouldn’t be so bad, but here comes the fun:
21, 31, 41, 161, etc. requires singular
22, 34, 53, 12562, etc requires plural/few
11–19, as well as 111, 412, 24215, etc requires plural/many
and that last rule usually makes people give up and let it go. It’s awesome to see go-i18n handling all that properly and hugo making good use of that.

1 Like

Great to hear. I created this related issue as a reminder that we should improve this “plural stuff”: https://github.com/gohugoio/hugo/issues/7791

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.