From 2016a635770d584133142ebfdc7a7537214dd50e Mon Sep 17 00:00:00 2001 From: Buliway Date: Thu, 11 Jul 2024 16:25:15 +0300 Subject: [PATCH] fix title translation --- i18n/en.yaml | 6 ++++++ i18n/ru.yaml | 6 ++++++ layouts/partials/data/title.html | 13 ++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/i18n/en.yaml b/i18n/en.yaml index 5a10971..f8b8752 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -19,9 +19,15 @@ list: categories: other: Categories + category: + other: Category + tags: other: Tags + tag: + other: Tag + article: back: other: Back diff --git a/i18n/ru.yaml b/i18n/ru.yaml index 7b15ae2..e1c2016 100644 --- a/i18n/ru.yaml +++ b/i18n/ru.yaml @@ -23,9 +23,15 @@ list: categories: other: Категории + category: + other: Категория + tags: other: Теги + tag: + other: Тег + article: back: other: Назад diff --git a/layouts/partials/data/title.html b/layouts/partials/data/title.html index 85a7bc7..817d49d 100644 --- a/layouts/partials/data/title.html +++ b/layouts/partials/data/title.html @@ -24,7 +24,15 @@ {{ $pag := .Paginate ($notHidden) }} - {{ $title = slice (title .Data.Singular) ": " $title }} + {{ $taxonomyTerm := .Title }} + {{ $taxonomyType := T (printf "list.%s" .Data.Singular | urlize | lower) }} + + {{ if eq (lower .Section) "tags" }} + {{ $translatedTag := T (printf "tags.%s" $taxonomyTerm | urlize | lower) }} + {{ $taxonomyTerm = $translatedTag | default $taxonomyTerm }} + {{ end }} + + {{ $title = slice (title $taxonomyType) ": " $taxonomyTerm }} {{ if .Paginator.HasPrev }} @@ -33,6 +41,9 @@ {{ $title = $title | append " - " $siteTitle }} {{ $title = delimit $title "" }} +{{- else if eq .Kind "taxonomy" -}} + + {{ $title = T (printf "list.%s" $title | urlize | lower) }} {{- end -}} {{ return $title }} \ No newline at end of file