Skip to content

Commit

Permalink
i18n made WordCount and ReadingTime singular/plural aware (#363)
Browse files Browse the repository at this point in the history
Co-authored-by: Regis Philibert <login@regisphilibert.com>
  • Loading branch information
MarcoWagner and regisphilibert committed Oct 1, 2021
1 parent 08d842f commit 7752770
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 8 additions & 0 deletions i18n/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,13 @@ other = "Senden"
[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"
10 changes: 9 additions & 1 deletion i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,13 @@ other = "Send"
[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"
other = "{{ .Name }} page"
4 changes: 2 additions & 2 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ <h1 class="f1 athelas mt3 mb1">
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">
Expand Down

0 comments on commit 7752770

Please sign in to comment.