I am trying to make a calendar using hugo. At the top of each month I’d like to have the month’s name displayed, so for example I have
{{ $t := "27 May 2024" }}
{{ time.Format "January 2006" $t }}
in english the output is fine, no issue.
May 2024
but in other languages, Polish in this case, we have grammar issues
maja 2024
maja is the wrong form in this case. Here we would want may, as in may itself (maj) not its possesive form.
The approach above is just a translation. To localize, use one of the localization tokens:
https://gohugo.io/functions/time/format/#localization
There isn’t a token for just month+year, so you’ll need to perform some string operations after the localization.
in Polish of them would be possessive so it would still be a case statement at that point, and only applicable to a singular language at a time
{{ "27 May 2024" | time.Format ":date_medium" }} --> 27 maj 2024
So in this case is maj
just an abbreviation?
its also the full word when non-possesive
so May 2023 → maj 2023
23rd of May → 23 maja
And the CLDR on this stuff is nowhere near complete. See:
https://cldr.unicode.org/development/development-process/design-proposals/grammar-capitalization-forms-for-datetime-elements-and-others
In a few years, when the Unicode Consortium can actually agree on something, and then revise the tables, the new data will trickle downstream, perhaps to be incorporated in packages like the one referenced above.