seanlane / gochowdown

Hugo theme based on the Jekyll chowdown theme
MIT License
71 stars 51 forks source link

Add basic i18n support + English/French/German translations #15

Closed hed854 closed 3 years ago

hed854 commented 3 years ago

I used this documentation to add i18n string translation: https://gohugo.io/content-management/multilingual/#translation-of-strings

I also added the following configuration in my config.toml:

defaultContentLanguage = "fr"

[languages]
[languages.en]
weight = 0
title = "my title"
[languages.fr]
weight = 1
title = "mon titre"

You can test rendering by using hugo serve -D --i18n-warnings in case of missing translations

Tiliavir commented 3 years ago

I think Components (Komponenten) and steps (Arbeitsschritte / Schritte) is missing? At least, I had to translate them a few commits behind head.

Deutsch / german.toml

[yields]
other = "Zutaten für"

[prepTime]
other = "Vorbereitungszeit"

[cookTime]
other = "Koch-/Backzeit"

[ingredients]
other = "Zutaten"

[directions]
other = "Arbeitsschritte"

[category]
other = "Kategorie"

[cuisine]
other = "Küche"

[tags]
other = "Tags"

[inspired]
other = "inspiriert"

[by]
other = "durch"

[from]
other = "von"

[powered-by]
other = "Powered by"

[for-the-home-chef]
other = "Für den Küchenchef"

[save-recipes]
other = "Speichern Sie Rezepte in Sekundenschnelle mit Klartextformatierung"

[create-beautiful]
other = "Erstellen Sie schöne Rezeptseiten mit automatisierter Leichtigkeit"

[use-recipes]
other = "Verwenden Sie Ihre Rezepte in jeder App"

[our-favorite]
other = "Unser Favorit ist"

[share]
other = "Teilen Sie mit Familie und Freunden"

[for-the-developer]
other = "Für den Entwickler"

[markdown-hugo]
other = "Markdown + Hugo under the hood"

[recipes-stored]
other = "Im Klartext gespeicherte Rezepte, bereit zum Hacken"

[open-source]
other = "Open source, alles ist auf GitHub"

[contribute]
other = "dazu beitragen"
Tiliavir commented 3 years ago

@hed854 I will make a PR on your fork this evening, adding the stuff mentioned above and fixing some of the english translations ...

hed854 commented 3 years ago

@Tiliavir Thanks for the feedback! I added the missing strings "Components" and "Steps" you mentioned (and their French translation) in the PR. And that's so cool you're adding the German translations!!

hed854 commented 3 years ago

Merged @Tiliavir contribution in the fork!

Tiliavir commented 3 years ago

Works like a charm! Tested it on my repo and I was able to build it with multiple languages at once. That might not make too much sense, since ingredients, directions units of measurement etc are defined for only one language ...

But it makes perfect sense to choose your language in the beginning and build specifically in english, french, german, or what ever the hack you come up with - love that change!

seanlane commented 3 years ago

Wow, this looks great, thanks for the input. I'll merge this and feel free to add more updates as needed.