diff options
author | Dmitry Mikhirev <mikhirev@gmail.com> | 2016-05-02 12:36:54 +0300 |
---|---|---|
committer | Dmitry Mikhirev <mikhirev@gmail.com> | 2016-05-02 12:36:54 +0300 |
commit | 6d1d8a8f8dd44c6778d24f72c1860bade872586b (patch) | |
tree | 433aef0d13b3bcd59049d71c2e5170d24e9657f3 | |
parent | dcc8f996d429e3467f9dab27ed072737e919c2e8 (diff) | |
download | searxng-6d1d8a8f8dd44c6778d24f72c1860bade872586b.tar.gz searxng-6d1d8a8f8dd44c6778d24f72c1860bade872586b.zip |
use ngettext
-rw-r--r-- | searx/webapp.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index ed8ff1bd9..b995e1fec 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -48,7 +48,7 @@ from flask import ( Flask, request, render_template, url_for, Response, make_response, redirect, send_from_directory ) -from flask.ext.babel import Babel, gettext, format_date +from flask.ext.babel import Babel, gettext, ngettext, format_date from searx import settings, searx_dir from searx.engines import ( categories, engines, get_engines_stats, engine_shortcuts @@ -411,9 +411,10 @@ def index(): minutes = int((timedifference.seconds / 60) % 60) hours = int(timedifference.seconds / 60 / 60) if hours == 0: - result['publishedDate'] = gettext(u'{minutes} minute(s) ago').format(minutes=minutes) + result['publishedDate'] = ngettext(u'{minutes} minute ago', u'{minutes} minutes ago', minutes).format(minutes=minutes) # noqa else: - result['publishedDate'] = gettext(u'{hours} hour(s), {minutes} minute(s) ago').format(hours=hours, minutes=minutes) # noqa + result['publishedDate'] = ngettext(u'{hours} hour, ', u'{hours} hours, ', hours).format(hours=hours) # noqa + result['publishedDate'] += ngettext(u'{minutes} minute ago', u'{minutes} minutes ago', minutes).format(minutes=minutes) # noqa else: result['publishedDate'] = format_date(result['publishedDate']) |