Skip to content

Commit

Permalink
Fix reading time #7
Browse files Browse the repository at this point in the history
  • Loading branch information
armandfardeau committed Apr 4, 2023
1 parent 373e1a8 commit ce33b49
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions assets/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ figure {
align-items: center;
flex-direction: row;
flex-wrap: wrap;
margin-bottom: 2rem;

.reading_time {
font-style: italic;
Expand Down
2 changes: 1 addition & 1 deletion i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- id: share_buttons_title
translation: Share this page on social networks
- id: reading_time_singular
translation: "Reading time: {{ . }} minute approximately"
translation: "Reading time: 1 minute approximately"
- id: reading_time_plural
translation: "Reading time: {{ . }} minutes approximately"
- id: Add an issue
Expand Down
2 changes: 1 addition & 1 deletion i18n/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- id: share_buttons_title
translation: Partager sur les réseaux sociaux
- id: reading_time_singular
translation: "Temps de lecture: {{ . }} minute environ"
translation: "Temps de lecture: 1 minute environ"
- id: reading_time_plural
translation: "Temps de lecture: {{ . }} minutes environ"
- id: Add an issue
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/docs/reading_time.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{ $seconds := mul (div (countwords .Content) 100) 25 }}
{{ $count := math.Round (div $seconds 60) }}

{{ if gt $count 2 }}
{{ if ge $count 2 }}
{{ i18n "reading_time_plural" $count }}
{{ else }}
{{ i18n "reading_time_singular" $count }}
{{ i18n "reading_time_singular" }}
{{ end }}

0 comments on commit ce33b49

Please sign in to comment.