logo

searx

My custom branche(s) on searx, a meta-search engine git clone https://hacktivis.me/git/searx.git
commit: d54ef01898a1bd289560ae757593df9f43fba7bc
parent ef2b1b7515fbc029d566ab1afb80429007983fbb
Author: Thomas Pointhuber <thomas.pointhuber@gmx.at>
Date:   Sat, 15 Mar 2014 19:41:54 +0100

simplify publish Date formating

Diffstat:

Msearx/webapp.py16++--------------
1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/searx/webapp.py b/searx/webapp.py @@ -164,21 +164,9 @@ def index(): minutes = int((timedifference.seconds/60)%60) hours = int(timedifference.seconds/60/60) if hours == 0: - if minutes == 1: - result['publishedDate'] = gettext(u'1 minute ago') - else: - result['publishedDate'] = gettext(u'{minutes} minutes ago').format(minutes=minutes) + result['publishedDate'] = gettext(u'{minutes} minute(s) ago').format(minutes=minutes) else: - if hours == 1: - if minutes == 1: - result['publishedDate'] = gettext(u'1 hour, 1 minute ago') - else: - result['publishedDate'] = gettext(u'1 hour, {minutes} minutes ago').format(minutes=minutes) - else: - if minutes == 1: - result['publishedDate'] = gettext(u'{hours} hours, 1 minutes ago').format(hours=hours) - else: - result['publishedDate'] = gettext(u'{hours} hours, {minutes} minutes ago').format(hours=hours, minutes=minutes) + result['publishedDate'] = gettext(u'{hours} hour(s), {minutes} minute(s) ago').format(hours=hours, minutes=minutes) else: result['publishedDate'] = format_date(result['publishedDate'])