diff --git a/template/templates/views/entry.html b/template/templates/views/entry.html index e3930c49..3d579d14 100644 --- a/template/templates/views/entry.html +++ b/template/templates/views/entry.html @@ -130,7 +130,7 @@ {{ end }} {{ if and .user.ShowReadingTime (gt .entry.ReadingTime 0) }} · - + {{ plural "entry.estimated_reading_time" .entry.ReadingTime .entry.ReadingTime }} {{ end }} diff --git a/ui/entry_scraper.go b/ui/entry_scraper.go index a7cc0403..e556dc94 100644 --- a/ui/entry_scraper.go +++ b/ui/entry_scraper.go @@ -9,6 +9,7 @@ import ( "miniflux.app/http/request" "miniflux.app/http/response/json" + "miniflux.app/locale" "miniflux.app/model" "miniflux.app/proxy" "miniflux.app/reader/processor" @@ -64,5 +65,7 @@ func (h *handler) fetchContent(w http.ResponseWriter, r *http.Request) { json.ServerError(w, r, err) } - json.OK(w, r, map[string]string{"content": proxy.ImageProxyRewriter(h.router, entry.Content)}) + readingTime := locale.NewPrinter(user.Language).Plural("entry.estimated_reading_time", entry.ReadingTime, entry.ReadingTime) + + json.OK(w, r, map[string]string{"content": proxy.ImageProxyRewriter(h.router, entry.Content), "reading_time": readingTime}) } diff --git a/ui/static/js/app.js b/ui/static/js/app.js index a58fd499..b8082fc8 100644 --- a/ui/static/js/app.js +++ b/ui/static/js/app.js @@ -334,8 +334,9 @@ function handleFetchOriginalContent() { element.innerHTML = previousInnerHTML; response.json().then((data) => { - if (data.hasOwnProperty("content")) { + if (data.hasOwnProperty("content") && data.hasOwnProperty("reading_time")) { document.querySelector(".entry-content").innerHTML = data.content; + document.querySelector(".entry-reading-time").innerHTML = data.reading_time; } }); });