Hugo Academic with german month names in date


#1

Is there a way to use german month names for all dates on the website?

In the config.toml I definded the defaultContentLanguage as “de”.
I can customize the date format but not the month names.
In the i18n is no entry for the months.


#2

I believe you’re asking about localization (l10n). Hugo doesn’t currently have a framework for that.


#3

Here’s how I did it:

data/months_german.toml:

"1" = "Januar"
"2" = "Februar"
"3" = "März"
"4" = "April"
"5" = "Mai"
"6" = "Juni"
"7" = "Juli"
"8" = "August"
"9" = "September"
"10" = "Oktober"
"11" = "November"
"12" = "Dezember"

And in the template:

{{ index site.Data.months_german (printf "%d" .Date.Month) }} {{ .Date.Year }}

Hope this helps.


#4

What if I need Jänner in the Austrian localization?

troll


#5

Nicht möglich :rofl:


#6

seufzs :sob::grinning: