Skip to content
This repository was archived by the owner on Dec 20, 2021. It is now read-only.

[Question] Months names translations #115

Answered by wblondel
kszpieg asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

This is how I got around this problem:

  • I copied the ./themes/uBlogger/layouts/_default/section.html file to ./layouts/_default/section.html
  • On line 28, I replaced
<div class="group-title-month">{{- .Key }}</div>

by

<div class="group-title-month">{{- i18n .Key | default .Key }}</div>

It will first check for the translated name of the month, if not found it will show the default one (in English).

  • In the i18n folder, I created a file for every language I want the months to be translated in, for example:

./i18n/fr.yaml

# === Dates translation ===
# (hacky solution until Hugo supports dates i18n)

# Months
January:
  other: "Janvier"
February:
  other: "Février"
March:
  other: "Mars"

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kszpieg
Comment options

Answer selected by kszpieg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants