diff options
author | Thomas Pointhuber <thomas.pointhuber@gmx.at> | 2014-03-14 10:55:52 +0100 |
---|---|---|
committer | Thomas Pointhuber <thomas.pointhuber@gmx.at> | 2014-03-14 10:55:52 +0100 |
commit | 7a922b2ab8464f32ebed03d4c2b652159891fdc7 (patch) | |
tree | c0c93a5db178f28d77cb027aacdac65f450a52c0 | |
parent | c54baf63015e884c060e10bc7a73a2c1503564c1 (diff) | |
download | searxng-7a922b2ab8464f32ebed03d4c2b652159891fdc7.tar.gz searxng-7a922b2ab8464f32ebed03d4c2b652159891fdc7.zip |
adding translations support for publish-date
-rw-r--r-- | searx/webapp.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 2f7f131c8..9d1221fa0 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -32,7 +32,7 @@ from flask import ( Flask, request, render_template, url_for, Response, make_response, redirect, send_from_directory ) -from flask.ext.babel import Babel +from flask.ext.babel import Babel, gettext, ngettext, format_date from searx import settings, searx_dir from searx.engines import ( search as do_search, categories, engines, get_engines_stats, @@ -162,11 +162,11 @@ def index(): if result['publishedDate'].date() == datetime.now().date(): timedifference = datetime.now()-result['publishedDate'] if timedifference.seconds < 60*60: - result['publishedDate'] = '{0:d} minutes ago'.format(timedifference.seconds/60) + result['publishedDate'] = gettext(u'{0:d} minutes ago').format(timedifference.seconds/60) else: - result['publishedDate'] = '{0:d} hours ago'.format(timedifference.seconds/60/60) + result['publishedDate'] = gettext(u'{0:d} hours ago').format(timedifference.seconds/60/60) else: - result['publishedDate'] = result['publishedDate'].strftime('%d.%m.%Y') + result['publishedDate'] = format_date(result['publishedDate']) if search.request_data.get('format') == 'json': return Response(json.dumps({'query': search.query, |