From b59137e458dfd8e6db81a32a5f948df26dafe2a5 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Mon, 24 Jan 2022 13:58:19 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90=20Add=20better=20i18n=20support=20?= =?UTF-8?q?for=20article=20metadata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- i18n/de.yaml | 3 ++- i18n/en.yaml | 3 ++- i18n/es.yaml | 3 ++- i18n/fr.yaml | 3 ++- i18n/pt-BR.yaml | 3 ++- i18n/tr.yaml | 3 ++- i18n/zh.yaml | 3 ++- layouts/partials/functions/date.html | 1 + layouts/partials/meta/date-updated.html | 5 +++-- layouts/partials/meta/date.html | 2 +- layouts/partials/meta/reading-time.html | 2 +- layouts/partials/meta/word-count.html | 3 +-- 13 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 layouts/partials/functions/date.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 95df262b..8ad843f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Changed - ⚠️ Required Hugo version is now 0.87.0 or later -- ⚠️ Author images are now Hugo assets +- ⚠️ Author and logo images are now Hugo assets - ⚠️ Overhauled `figure` shortcode which now resizes images - ⚠️ Renamed parameter: `darkToggle` -> `showDarkToggle` - Upgrade to Tailwind v3.0.15 diff --git a/i18n/de.yaml b/i18n/de.yaml index 694f96a8..5a2d23db 100644 --- a/i18n/de.yaml +++ b/i18n/de.yaml @@ -1,5 +1,7 @@ article: anchor_label: "Anker" + date: "{{ .Date }}" + # date_updated: "Updated: {{ .Date }}" draft: "Entwurf" edit_title: "Inhalt bearbeiten" reading_time: @@ -7,7 +9,6 @@ article: other: "{{ .Count }} min" reading_time_title: "Lesezeit" # table_of_contents: "Table of Contents" - # updated: "Updated" # word_count: # one: "{{ .Count }} word" # other: "{{ .Count }} words" diff --git a/i18n/en.yaml b/i18n/en.yaml index 7f2035c7..265b298d 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -1,5 +1,7 @@ article: anchor_label: "Anchor" + date: "{{ .Date }}" + date_updated: "Updated: {{ .Date }}" draft: "Draft" edit_title: "Edit content" reading_time: @@ -7,7 +9,6 @@ article: other: "{{ .Count }} mins" reading_time_title: "Reading time" table_of_contents: "Table of Contents" - updated: "Updated" word_count: one: "{{ .Count }} word" other: "{{ .Count }} words" diff --git a/i18n/es.yaml b/i18n/es.yaml index 9fe23681..74afcf3b 100644 --- a/i18n/es.yaml +++ b/i18n/es.yaml @@ -1,5 +1,7 @@ article: anchor_label: "Ancla" + date: "{{ .Date }}" + date_updated: "Actualizado: {{ .Date }}" draft: "Borrador" edit_title: "Editar contenido" reading_time: @@ -7,7 +9,6 @@ article: other: "{{ .Count }} mins" reading_time_title: "Tiempo de lectura" # table_of_contents: "Table of Contents" - updated: "Actualizado" word_count: one: "{{ .Count }} palabra" other: "{{ .Count }} palabras" diff --git a/i18n/fr.yaml b/i18n/fr.yaml index a8783bc7..f9c270ec 100644 --- a/i18n/fr.yaml +++ b/i18n/fr.yaml @@ -1,5 +1,7 @@ article: anchor_label: "Ancre" + date: "{{ .Date }}" + # date_updated: "Updated: {{ .Date }}" draft: "Brouillon" edit_title: "Editer" reading_time: @@ -7,7 +9,6 @@ article: other: "{{ .Count }} mins" reading_time_title: "Temps de lecture" # table_of_contents: "Table of Contents" - # updated: "Updated" # word_count: # one: "{{ .Count }} word" # other: "{{ .Count }} words" diff --git a/i18n/pt-BR.yaml b/i18n/pt-BR.yaml index 01b12997..bd06e2ea 100644 --- a/i18n/pt-BR.yaml +++ b/i18n/pt-BR.yaml @@ -1,5 +1,7 @@ article: anchor_label: "Anchor" + date: "{{ .Date }}" + # date_updated: "Updated: {{ .Date }}" draft: "Draft" edit_title: "Editar Conteúdo" reading_time: @@ -7,7 +9,6 @@ article: other: "{{ .Count }} minutos" reading_time_title: "Tempo de leitura" # table_of_contents: "Table of Contents" - # updated: "Updated" # word_count: # one: "{{ .Count }} word" # other: "{{ .Count }} words" diff --git a/i18n/tr.yaml b/i18n/tr.yaml index e6c4f51d..2b514296 100644 --- a/i18n/tr.yaml +++ b/i18n/tr.yaml @@ -1,12 +1,13 @@ article: anchor_label: "Anchor" + date: "{{ .Date }}" + # date_updated: "Updated: {{ .Date }}" draft: "Taslak" edit_title: "İçeriği düzenle" reading_time: one: "{{ .Count }} dk" other: "{{ .Count }} dk" reading_time_title: "Okuma süresi" - # updated: "Updated" word_count: one: "{{ .Count }} kelime" other: "{{ .Count }} kelime" diff --git a/i18n/zh.yaml b/i18n/zh.yaml index 2f649e3e..0d1d6fb1 100644 --- a/i18n/zh.yaml +++ b/i18n/zh.yaml @@ -1,12 +1,13 @@ article: anchor_label: "锚点" + date: "{{ .Date }}" + # date_updated: "Updated: {{ .Date }}" draft: "草稿" edit_title: "编辑内容" reading_time: other: "{{ .Count }} 分钟" reading_time_title: "预计阅读" # table_of_contents: "Table of Contents" - # updated: "Updated" word_count: one: "{{ .Count }} 字" other: "{{ .Count }} 字" diff --git a/layouts/partials/functions/date.html b/layouts/partials/functions/date.html new file mode 100644 index 00000000..d9ae5439 --- /dev/null +++ b/layouts/partials/functions/date.html @@ -0,0 +1 @@ +{{ return time.Format (site.Language.Params.dateFormat | default ":date_long") . }} diff --git a/layouts/partials/meta/date-updated.html b/layouts/partials/meta/date-updated.html index 367486f4..cc25c693 100644 --- a/layouts/partials/meta/date-updated.html +++ b/layouts/partials/meta/date-updated.html @@ -1,3 +1,4 @@ -{{- i18n "article.updated" -}}:  -{{ partial "meta/date.html" . }} + {{- /* Trim EOF */ -}} diff --git a/layouts/partials/meta/date.html b/layouts/partials/meta/date.html index de62590a..654a6c7a 100644 --- a/layouts/partials/meta/date.html +++ b/layouts/partials/meta/date.html @@ -1,4 +1,4 @@ {{- /* Trim EOF */ -}} diff --git a/layouts/partials/meta/reading-time.html b/layouts/partials/meta/reading-time.html index d1539e28..71e706d4 100644 --- a/layouts/partials/meta/reading-time.html +++ b/layouts/partials/meta/reading-time.html @@ -1,4 +1,4 @@ - {{- i18n "article.reading_time" .ReadingTime | emojify -}} + {{- i18n "article.reading_time" .ReadingTime | markdownify | emojify -}} {{- /* Trim EOF */ -}} diff --git a/layouts/partials/meta/word-count.html b/layouts/partials/meta/word-count.html index e68ec0d6..517101a9 100644 --- a/layouts/partials/meta/word-count.html +++ b/layouts/partials/meta/word-count.html @@ -1,5 +1,4 @@ - {{- i18n "article.word_count" .WordCount | emojify -}} + {{- i18n "article.word_count" .WordCount | markdownify | emojify -}} {{- /* Trim EOF */ -}} - \ No newline at end of file