From 775277039eab2161823621329902622b1cc17a23 Mon Sep 17 00:00:00 2001
From: Marco Kinski <kinski@genodata.de>
Date: Fri, 01 Oct 2021 17:23:28 +0000
Subject: [PATCH] i18n made WordCount and ReadingTime singular/plural aware (#363)
---
layouts/_default/single.html | 4 ++--
i18n/en.toml | 10 +++++++++-
i18n/de.toml | 8 ++++++++
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/i18n/de.toml b/i18n/de.toml
index 11c8fdb..d54cf08 100644
--- a/i18n/de.toml
+++ b/i18n/de.toml
@@ -34,5 +34,13 @@
[taxonomyPageList]
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
+[readingTime]
+one = "Eine Minute"
+other = "{{ .Count }} Minuten"
+
+[wordCount]
+one = "Ein Wort"
+other = "{{ .Count }} Wörter"
+
[pageTitle]
other = "{{ .Name }} Seite"
\ No newline at end of file
diff --git a/i18n/en.toml b/i18n/en.toml
index 5adbe27..755e3b0 100644
--- a/i18n/en.toml
+++ b/i18n/en.toml
@@ -34,5 +34,13 @@
[taxonomyPageList]
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
+[readingTime]
+one = "One minute read"
+other = "{{ .Count }} minutes read"
+
+[wordCount]
+one = "One word"
+other = "{{ .Count }} words"
+
[pageTitle]
-other = "{{ .Name }} page"
\ No newline at end of file
+other = "{{ .Name }} page"
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 2f2eed3..0c7b97b 100755
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -43,8 +43,8 @@
3) A page front matter value is set `show_reading_time = true`
*/}}
{{ if (or (eq (.Param "show_reading_time") true) (eq $section.Params.show_reading_time true) )}}
- <span class="f6 mv4 dib tracked"> - {{ .ReadingTime}} minutes read</span>
- <span class="f6 mv4 dib tracked"> - {{ .WordCount}} words</span>
+ <span class="f6 mv4 dib tracked"> - {{ i18n "readingTime" .ReadingTime }} </span>
+ <span class="f6 mv4 dib tracked"> - {{ i18n "wordCount" .WordCount }} </span>
{{ end }}
</header>
<div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes" | default "serif"}} f4 nested-links nested-img mid-gray pr4-l w-two-thirds-l">
--
Gitblit v1.10.0