From c42d3d031f8efd356bbc88a7484e22d03df23e87 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Sun, 31 May 2020 14:43:01 +0200 Subject: [PATCH] display content translation if a traduction exists for the current page, display an icon, the language code and an URL --- i18n/en.toml | 3 +++ i18n/fr.toml | 3 +++ layouts/partials/entry/meta.html | 1 + layouts/partials/entry/meta/translations.html | 7 +++++++ layouts/partials/svg/icons.html | 2 ++ 5 files changed, 16 insertions(+) create mode 100644 layouts/partials/entry/meta/translations.html diff --git a/i18n/en.toml b/i18n/en.toml index b790c5d7..dac18038 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -154,5 +154,8 @@ other = "Tags" [toggleSidebar] other = "Toggle Sidebar" +[translations] +other = "Translations" + [website] other = "Website" diff --git a/i18n/fr.toml b/i18n/fr.toml index 99ff658b..c81af916 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -151,5 +151,8 @@ other = "Étiquettes" [toggleSidebar] other = "Déplier la barre latérale" +[translations] +other = "Traductions" + [website] other = "Site web" diff --git a/layouts/partials/entry/meta.html b/layouts/partials/entry/meta.html index 8f6aa2ec..4d7fff76 100644 --- a/layouts/partials/entry/meta.html +++ b/layouts/partials/entry/meta.html @@ -13,5 +13,6 @@ {{ partial "entry/meta/posted-on" . }} {{ partial "entry/meta/author" . }} {{ partial "entry/meta/reading-time" . }} + {{ partial "entry/meta/translations" . }} {{ end }} diff --git a/layouts/partials/entry/meta/translations.html b/layouts/partials/entry/meta/translations.html new file mode 100644 index 00000000..6a51967a --- /dev/null +++ b/layouts/partials/entry/meta/translations.html @@ -0,0 +1,7 @@ +{{- partial "svg/icons" "translations" -}} +{{ if .IsTranslated }} + {{ i18n "translations" }} + {{ range .Translations }} + {{ .Lang }} + {{ end }} +{{ end }} diff --git a/layouts/partials/svg/icons.html b/layouts/partials/svg/icons.html index 8bc9d418..afa1b5c4 100644 --- a/layouts/partials/svg/icons.html +++ b/layouts/partials/svg/icons.html @@ -73,5 +73,7 @@ {{ else if eq "search" . }} + {{ else if eq "translations" . }} + {{ end }}