Hugo Academic with german month names in date

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.

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

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.

5 Likes

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

troll

Nicht möglich :rofl:

2 Likes

seufzs :sob::grinning:

1 Like

I am new to this topic. Which one is the template file? Is it the used theme?

Hi @Leo_Merkel
Thanks!! I have some questions:

  1. The /data/months_german.toml is the data folder of the personal site or is /theme/academic/data root?
  2. Where are the templates root directory?

Kindest Regards :grinning: :grinning:

  1. The data Folder of the personal site
  2. In the layouts Folder of the personal site
1 Like