From 8915e56e6e08ca34b37f3bbb2f8ae15a7fb43b17 Mon Sep 17 00:00:00 2001 From: Regis Philibert Date: Thu, 7 Apr 2022 13:34:56 -0400 Subject: Localize "By" (#530) * Localize "By" for some languages (En/De/Es/Fr/It/Pt/No) and wrap string in a dedicated template. Fixes #528 --- i18n/de.toml | 3 +++ i18n/en.toml | 3 +++ i18n/es.toml | 3 +++ i18n/fr.toml | 3 +++ i18n/it.toml | 3 +++ i18n/no.toml | 3 +++ i18n/pt.toml | 3 +++ layouts/_default/by.html | 3 +++ layouts/_default/single.html | 14 +++++++------- 9 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 layouts/_default/by.html diff --git a/i18n/de.toml b/i18n/de.toml index 1109b97..c0b4f10 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -10,6 +10,9 @@ other = "Neuste {{.Title }}" [readMore] other = "weiterlesen" +[by] +other = "Von" + [whatsInThis] other = "Was ist in dieser {{ .Type }}" diff --git a/i18n/en.toml b/i18n/en.toml index 755e3b0..4e5638d 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -10,6 +10,9 @@ other = "Recent {{.Title }}" [readMore] other = "read more" +[by] +other = "By" + [whatsInThis] other = "What's in this {{ .Type }}" diff --git a/i18n/es.toml b/i18n/es.toml index ed7c31f..e5d61b1 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -10,6 +10,9 @@ other = "{{.Title }} recientes" [readMore] other = "Leer más" +[by] +other = "Por" + [whatsInThis] other = "Qué hay en este {{ .Type }}" diff --git a/i18n/fr.toml b/i18n/fr.toml index fb7d42b..47d20aa 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -10,6 +10,9 @@ other = "{{.Title }} récents" [readMore] other = "lire plus" +[by] +other = "Par" + [whatsInThis] other = "Ce qui est dans {{ .Type }}" diff --git a/i18n/it.toml b/i18n/it.toml index 417f4ac..51b96c4 100644 --- a/i18n/it.toml +++ b/i18n/it.toml @@ -10,6 +10,9 @@ other = "Recenti {{.Title }}" [readMore] other = "leggi di più" +[by] +other = "Da" + [whatsInThis] other = "Cosa c'è in {{ .Type }}" diff --git a/i18n/no.toml b/i18n/no.toml index d6165f6..40b2aca 100644 --- a/i18n/no.toml +++ b/i18n/no.toml @@ -10,6 +10,9 @@ other = "Nyeste {{.Title }}" [readMore] other = "Les mer" +[by] +other = "Av" + [whatsInThis] other = "Innhold av {{ .Type }}" diff --git a/i18n/pt.toml b/i18n/pt.toml index 024cd42..2e45736 100644 --- a/i18n/pt.toml +++ b/i18n/pt.toml @@ -10,6 +10,9 @@ other = "{{.Title }} Recentes" [readMore] other = "Leia mais" +[by] +other = "por" + [whatsInThis] other = "O que há neste {{ .Type }}" diff --git a/layouts/_default/by.html b/layouts/_default/by.html new file mode 100644 index 0000000..2170065 --- /dev/null +++ b/layouts/_default/by.html @@ -0,0 +1,3 @@ +{{- if eq .Lang "de" "en" "es" "fr" "it" "no" "pt" -}} +{{- i18n "by" -}} +{{ end -}} \ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html index aa871f0..a40a4c5 100755 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -20,13 +20,13 @@ {{ with .Params.author | default .Site.Params.author }}

- By - {{ if reflect.IsSlice . }} - {{ delimit . ", " | markdownify }} - {{else}} - {{ . | markdownify }} - {{ end }} - + {{ $.Render "by" }} + {{- if reflect.IsSlice . -}} + {{ delimit . ", " | markdownify }} + {{- else -}} + {{ . | markdownify }} + {{- end -}} +

{{ end }} {{/* Hugo uses Go's date formatting is set by example. Here are two formats */}} -- cgit v1.2.3