From a57a8f991a2a5960fc886aa8bfcfca9719cecfda Mon Sep 17 00:00:00 2001 From: Arne Rief Date: Fri, 19 Sep 2025 19:20:39 +0200 Subject: Flat i18n tables --- assets/css/main.css | 2 +- hugo.toml | 7 +- i18n/de.toml | 126 ++++++++++++++++---------------- i18n/en.toml | 126 ++++++++++++++++---------------- layouts/404.html | 6 +- layouts/_default/all-posts.html | 4 +- layouts/_default/home.html | 2 +- layouts/_default/list.html | 6 +- layouts/_default/search.html | 12 +-- layouts/partials/list/pagination.html | 12 +-- layouts/partials/list/post-card.html | 6 +- layouts/partials/list/recent-posts.html | 6 +- layouts/partials/navmenu.html | 2 +- layouts/partials/select-theme.html | 6 +- layouts/partials/single/next-prev.html | 10 +-- layouts/partials/single/tags.html | 2 +- layouts/tags/list.html | 10 +-- layouts/tags/term.html | 12 +-- 18 files changed, 183 insertions(+), 174 deletions(-) diff --git a/assets/css/main.css b/assets/css/main.css index 4431c30..10d7493 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -368,7 +368,7 @@ time { margin-bottom: var(--gap-large); } -.post-navigation > hr { +.post__navigation > hr { height: 2px; margin-bottom: var(--gap-large); } diff --git a/hugo.toml b/hugo.toml index b7e2d8a..41d29c0 100644 --- a/hugo.toml +++ b/hugo.toml @@ -19,8 +19,9 @@ disableDefaultLanguageRedirect = false languageCode = "de-DE" languageName = "Deutsch" weight = 2 - + [[languages.de.menus.main]] + # identifier = translation key in i18n toml file, can be called as .Identifier in templates; "name" is fallback identifier = "home" name = "Startseite" pageRef = "/" @@ -36,8 +37,8 @@ disableDefaultLanguageRedirect = false identifier = "search" name = "Suche" pageRef = "/search/" - weight = 20 - + weight = 30 + [languages.en] contentDir = "content/en" languageCode = "en-US" diff --git a/i18n/de.toml b/i18n/de.toml index ee47a2d..7051518 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -1,62 +1,66 @@ # GERMAN translations -[common] - more = "mehr" - next = "Weiter" - previous = "Zurück" - -[header] - navmenu = "Webseiten Navigation" - -[list] - default_description = "Alle Beiträge in {{ . }}" - empty = "Keine Beiträge in diesem Bereich." - reading_time = "Geschätzte Lesezeit: {{ . }} min" - word_count = "{{ . }} Wörter" - -[pagination] - current = "Aktuelle Seite" - go_to = "Gehe zu Seite" - label = "Seiten Navigation" - next_page = "Nächste Seite" - position = "Seite {{ . }} von {{ . }}" - previous_page = "Vorherige Seite" - -[posts] - all_description = "Alle Beiträge auf dieser Webseite, vom Neuesten zum Ältesten." - empty = "Auf dieser Seite gibt es noch keine Beiträge." - name = "Beiträge" - navigation = "Beitrag Navigation" - next = "Nächster Beitrag:" - previous = "Vorheriger Beitrag:" - recent = "Neueste Beiträge" - top = "Zurück zum Anfang" - view_all = "Alle Beiträge" - -[search] - description = "Beiträge mit Wortsuche finden." - label = "Alle Beiträge durchsuchen" - matches = "Treffer" - placeholder = "Mindestens drei Buchstaben tippen, um zu suchen..." - reset = "Suche löschen" - title = "Suche" - -[tags] - all_title = "Alle Schlagwörter" - all_description= "Übersicht aller Themen auf dieser Webseite:" - empty = "Keine Schlagwörter gefunden." - name = "Schlagwörter" - navigation = "Schlagwörter Navigation" - no_posts = "Keine Artikel mit diesem Schlagwort gefunden." - postcount_number = "{{ . }} Artikel gefunden" - postcount_title = "Anzahl der Artikel" - posts_list = "Artikel mit diesem Schlagwort:" - tagged_with = "Getaggt mit:" - -[theme] - toggle_dark = "Dunklen Modus aktivieren" - toggle_light = "Hellen Modus aktivieren" - -[404] - title = "Seite nicht gefunden" - description = "Die angefragte Seite existiert nicht." - homepage = "Zurück zur Startseite" +about = "Über mich" +articles = "Artikel" +contact = "Kontakt" +home = "Home" +more = "mehr" +reading_time = "Geschätzte Lesezeit: {{ . }} min" +word_count = "{{ . }} Wörter" + +# 404 +404_title = "Seite nicht gefunden" +404_description = "Die angefragte Seite existiert nicht." +404_homepage = "Zurück zur Startseite" + +# List +list_description = "Alle Beiträge in {{ . }}" +list_empty = "Keine Beiträge in diesem Bereich." + +# Navigation +back_top = "Zurück zum Anfang" +navmenu = "Webseiten Navigation" +next = "Weiter" +previous = "Zurück" + +# Pagination +page = "Seite" +page_current = "Aktuelle Seite" +page_go_to = "Gehe zu Seite" +page_navigation = "Seiten Navigation" +page_next = "Nächste Seite" +page_position = "Seite {{ . }} von {{ . }}" +page_previous = "Vorherige Seite" + +# Posts +posts = "Beiträge" +posts_all_description = "Alle Beiträge auf dieser Webseite, vom Neuesten zum Ältesten." +posts_all_view = "Alle Beiträge" +posts_empty = "Auf dieser Seite gibt es noch keine Beiträge." +posts_navigation = "Beitrag Navigation" +posts_next = "Nächster Beitrag:" +posts_previous = "Vorheriger Beitrag:" +posts_recent = "Neueste Beiträge" + +# Search +search = "Suche" +search_description = "Beiträge mit Wortsuche finden." +search_label = "Alle Beiträge durchsuchen" +search_matches = "Treffer" +search_placeholder = "Mindestens drei Buchstaben tippen, um zu suchen..." +search_reset = "Suche löschen" + +# Tags +tags = "Schlagwörter" +tags_all = "Alle Schlagwörter" +tags_all_description = "Übersicht aller Themen auf dieser Webseite:" +tags_empty = "Keine Schlagwörter gefunden." +tags_navigation = "Schlagwörter Navigation" +tags_no_posts = "Keine Artikel mit diesem Schlagwort gefunden." +tags_postcount_number = "{{ . }} Artikel gefunden" +tags_postcount_title = "Anzahl der Artikel" +tags_posts_list = "Artikel mit diesem Schlagwort:" +tags_with = "Getaggt mit:" + +# Theme +toggle_dark = "Dunklen Modus aktivieren" +toggle_light = "Hellen Modus aktivieren" diff --git a/i18n/en.toml b/i18n/en.toml index a053395..826674e 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -1,62 +1,66 @@ # ENGLISH translations -[common] - more = "more" - next = "Next" - previous = "Previous" - -[header] - navmenu = "Website navigation" - -[list] - default_description = "All posts in {{ . }}" - empty = "No posts in this section." - reading_time= "Estimated reading time: {{ . }} min" - word_count = "{{ . }} words" - -[pagination] - current = "Current page" - go_to = "Go to page" - label = "Page navigation" - next_page = "Next page" - position = "Page {{ . }} of {{ . }}" - previous_page = "Previous page" - -[posts] - all_description = "All posts on this website, from newest to oldest." - empty = "This site does not have any posts yet." - name = "Posts" - navigation = "Post navigation" - next = "Next post:" - previous = "Previous post:" - recent = "Recent Posts" - top = "Back to top" - view_all = "View all posts" - -[search] - description = "Find posts by search term." - label = "Search all posts" - matches = "matches" - placeholder = "Type at least 3 characters to search..." - reset = "Clear search" - title = "Search" - -[tags] - all_title = "All tags" - all_description = "Overview of all topics covered on this site:" - empty = "No tags found." - name = "Tags" - navigation = "Tag navigation" - no_posts = "No posts found with this tag." - postcount_number = "{{ . }} posts found" - postcount_title = "Number of posts" - posts_list = "Posts with this tag:" - tagged_with = "Tagged with:" - -[theme] - toggle_dark = "Switch to dark mode" - toggle_light = "Switch to light mode" - -[404] - title = "Page not found" - description = "The requested page does not exist." - homepage = "Back to the homepage" +about = "About" +articles = "Articles" +contact = "Contact" +home = "Home" +more = "more" +reading_time = "Estimated reading time: {{ . }} min" +word_count = "{{ . }} words" + +# 404 +404_title = "Page not found" +404_description = "The requested page does not exist." +404_homepage = "Back to the homepage" + +# List +list_description = "All posts in {{ . }}" +list_empty = "No posts in this section." + +# Navigation +back_top = "Back to top" +navmenu = "Website navigation" +next = "Next" +previous = "Previous" + +# Pagination +page = "Page" +page_current = "Current page" +page_go_to = "Go to page" +page_navigation = "Page navigation" +page_next = "Next page" +page_position = "Page {{ . }} of {{ . }}" +page_previous = "Previous page" + +# Posts +posts = "Posts" +posts_all_description = "All posts on this website, from newest to oldest." +posts_all_view = "View all posts" +posts_empty = "This site does not have any posts yet." +posts_navigation = "Post navigation" +posts_next = "Next post:" +posts_previous = "Previous post:" +posts_recent = "Recent Posts" + +# Search +search = "Search" +search_description = "Find posts by search term." +search_label = "Search all posts" +search_matches = "matches" +search_placeholder = "Type at least 3 characters to search..." +search_reset = "Clear search" + +# Tags +tags = "Tags" +tags_all = "All tags" +tags_all_description = "Overview of all topics covered on this site:" +tags_empty = "No tags found." +tags_navigation = "Tag navigation" +tags_no_posts = "No posts found with this tag." +tags_postcount_number = "{{ . }} posts found" +tags_postcount_title = "Number of posts" +tags_posts_list = "Posts with this tag:" +tags_with = "Tagged with:" + +# Theme +toggle_dark = "Switch to dark mode" +toggle_light = "Switch to light mode" diff --git a/layouts/404.html b/layouts/404.html index 388844b..8e46d6d 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,10 +1,10 @@ {{- define "main" }}
-

{{ lang.Translate "404.title" | default "Page not found" }}

-

{{ lang.Translate "404.description" | default "The requested page does not exist" }}

+

{{ lang.Translate "404_title" | default "Page not found" }}

+

{{ lang.Translate "404_description" | default "The requested page does not exist" }}

- {{ lang.Translate "404.homepage" | default "Back to the homepage" }} + {{ lang.Translate "404_homepage" | default "Back to the homepage" }}

diff --git a/layouts/_default/all-posts.html b/layouts/_default/all-posts.html index 319a8d5..d2ce8ee 100644 --- a/layouts/_default/all-posts.html +++ b/layouts/_default/all-posts.html @@ -9,7 +9,7 @@ {{ . }} {{- else }} - {{- $description := or .Description (lang.Translate "posts.all_description" | default "All posts on this website, from newest to oldest.") }} + {{- $description := or .Description (lang.Translate "posts_all_description" | default "All posts on this website, from newest to oldest.") }}

{{ $description }}

@@ -29,7 +29,7 @@ {{ else }}

- {{ lang.Translate "posts.empty" | default "This site does not have any posts yet." }} + {{ lang.Translate "posts_empty" | default "This site does not have any posts yet." }}

{{- end }} diff --git a/layouts/_default/home.html b/layouts/_default/home.html index 031e3b5..880f124 100644 --- a/layouts/_default/home.html +++ b/layouts/_default/home.html @@ -16,7 +16,7 @@ {{- partial "list/recent-posts.html" (dict "count" 5 - "title" (lang.Translate "posts.recent" | default "Recent Articles") + "title" (lang.Translate "posts_recent" | default "Recent Articles") "show_view_all" true ) -}} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index a8cb92a..fb53b40 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -9,14 +9,14 @@ {{ . }} {{- else }} - {{- $description := or .Description .Summary (lang.Translate "list.default_description" .Title | default (printf "All posts in %s" .Title)) }} + {{- $description := or .Description .Summary (lang.Translate "list_description" .Title | default (printf "All posts in %s" .Title)) }}

{{ $description }}

{{- end }} -
+
{{- /* 15 posts per site */ -}} {{- $paginator := .Paginate .Pages 15 }} {{- with $paginator.Pages }} @@ -29,7 +29,7 @@ {{ else }}

- {{ lang.Translate "list.empty" | default "No posts found in this section." }} + {{ lang.Translate "list_empty" | default "No posts found in this section." }}

{{- end }}
diff --git a/layouts/_default/search.html b/layouts/_default/search.html index 7ddaba2..90a6357 100644 --- a/layouts/_default/search.html +++ b/layouts/_default/search.html @@ -9,17 +9,17 @@ {{ . }} {{- else }} - {{- $description := or .Description (lang.Translate "search.description" | default "Find posts by search term.") }} + {{- $description := or .Description (lang.Translate "search_description" | default "Find posts by search term.") }}

{{ $description }}

{{- end }} -
+
diff --git a/layouts/partials/navmenu.html b/layouts/partials/navmenu.html index e833168..af0fc2e 100644 --- a/layouts/partials/navmenu.html +++ b/layouts/partials/navmenu.html @@ -11,7 +11,7 @@ Simplified version of the `hugo new template` menu.html default. Renders a menu {{- $menuID := .menuID }} {{- with index site.Menus $menuID }} -