From 67b8ac5516fd4418407da0ba72a3ba2ce725c450 Mon Sep 17 00:00:00 2001 From: Buliway Date: Thu, 11 Jul 2024 15:48:52 +0300 Subject: [PATCH] fix tag translation --- i18n/en.yaml | 6 ++++++ i18n/ru.yaml | 6 ++++++ layouts/_default/list.html | 17 +++++++++++++++-- layouts/partials/article-list/compact.html | 14 ++++++++++++-- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/i18n/en.yaml b/i18n/en.yaml index 7a0b527..5a10971 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -16,6 +16,12 @@ list: one: Subsection other: Subsections + categories: + other: Categories + + tags: + other: Tags + article: back: other: Back diff --git a/i18n/ru.yaml b/i18n/ru.yaml index 79afb2f..7b15ae2 100644 --- a/i18n/ru.yaml +++ b/i18n/ru.yaml @@ -20,6 +20,12 @@ list: many: Подразделы other: Подразделы + categories: + other: Категории + + tags: + other: Теги + article: back: other: Назад diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 9bc618d..4f2dd7c 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -4,14 +4,27 @@ {{ if eq .Parent (.GetPage "/") }} {{ T "list.section" }} {{ else }} - {{ .Parent.Title }} + {{ T (printf "list.%s" .Parent.Title | urlize | lower) }} {{ end }}

{{ T "list.page" (len .Pages) }}

-

{{ .Title }}

+ + {{- $title := lower .Title -}} + {{- $section := lower .Section -}} + + {{- if eq $title $section -}} + {{- $title = T (printf "list.%s" .Title | urlize | lower) -}} + {{- else if eq $section "tags" -}} + {{- $title = T (printf "tags.%s" .Title | urlize | lower) -}} + {{- else -}} + {{- $title = .Title -}} + {{- end -}} + +

{{ $title }}

+ {{ with .Params.description }}

{{ . }}

{{ end }} diff --git a/layouts/partials/article-list/compact.html b/layouts/partials/article-list/compact.html index 376512a..79e9784 100644 --- a/layouts/partials/article-list/compact.html +++ b/layouts/partials/article-list/compact.html @@ -1,12 +1,22 @@