Localize "By" (#530)

* Localize "By" for some languages (En/De/Es/Fr/It/Pt/No) and wrap string in a dedicated template.

Fixes #528
This commit is contained in:
Regis Philibert 2022-04-07 13:34:56 -04:00 committed by GitHub
parent c3f177ebd4
commit 8915e56e6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 31 additions and 7 deletions

View File

@ -10,6 +10,9 @@ other = "Neuste {{.Title }}"
[readMore]
other = "weiterlesen"
[by]
other = "Von"
[whatsInThis]
other = "Was ist in dieser {{ .Type }}"

View File

@ -10,6 +10,9 @@ other = "Recent {{.Title }}"
[readMore]
other = "read more"
[by]
other = "By"
[whatsInThis]
other = "What's in this {{ .Type }}"

View File

@ -10,6 +10,9 @@ other = "{{.Title }} recientes"
[readMore]
other = "Leer más"
[by]
other = "Por"
[whatsInThis]
other = "Qué hay en este {{ .Type }}"

View File

@ -10,6 +10,9 @@ other = "{{.Title }} récents"
[readMore]
other = "lire plus"
[by]
other = "Par"
[whatsInThis]
other = "Ce qui est dans {{ .Type }}"

View File

@ -10,6 +10,9 @@ other = "Recenti {{.Title }}"
[readMore]
other = "leggi di più"
[by]
other = "Da"
[whatsInThis]
other = "Cosa c'è in {{ .Type }}"

View File

@ -10,6 +10,9 @@ other = "Nyeste {{.Title }}"
[readMore]
other = "Les mer"
[by]
other = "Av"
[whatsInThis]
other = "Innhold av {{ .Type }}"

View File

@ -10,6 +10,9 @@ other = "{{.Title }} Recentes"
[readMore]
other = "Leia mais"
[by]
other = "por"
[whatsInThis]
other = "O que há neste {{ .Type }}"

3
layouts/_default/by.html Normal file
View File

@ -0,0 +1,3 @@
{{- if eq .Lang "de" "en" "es" "fr" "it" "no" "pt" -}}
{{- i18n "by" -}}
{{ end -}}

View File

@ -20,13 +20,13 @@
</h1>
{{ with .Params.author | default .Site.Params.author }}
<p class="tracked">
By <strong>
{{ if reflect.IsSlice . }}
{{ delimit . ", " | markdownify }}
{{else}}
{{ . | markdownify }}
{{ end }}
</strong>
{{ $.Render "by" }} <strong>
{{- if reflect.IsSlice . -}}
{{ delimit . ", " | markdownify }}
{{- else -}}
{{ . | markdownify }}
{{- end -}}
</strong>
</p>
{{ end }}
{{/* Hugo uses Go's date formatting is set by example. Here are two formats */}}