Ticket #15981: ungettext_naturaltime.py

File ungettext_naturaltime.py, 1.0 KB (added by Gasper Zejn, 13 years ago)

ungettext_naturaltime - fix gettext in naturaltime template filter

Line 
1Index: django/contrib/humanize/templatetags/humanize.py
2===================================================================
3--- django/contrib/humanize/templatetags/humanize.py (revision 16180)
4+++ django/contrib/humanize/templatetags/humanize.py (working copy)
5@@ -152,13 +152,9 @@
6 elif delta.seconds == 0:
7 return _(u'now')
8 elif delta.seconds < 60:
9- return _(u'%s seconds ago' % (delta.seconds))
10- elif delta.seconds / 60 < 2:
11- return _(r'a minute ago')
12+ return ungettext(u'%s seconds ago', u'%s seconds ago', delta.seconds)
13 elif delta.seconds / 60 < 60:
14- return _(u'%s minutes ago' % (delta.seconds/60))
15- elif delta.seconds / 60 / 60 < 2:
16- return _(u'an hour ago')
17+ return ungettext(u'a minute ago', u'%s minutes ago', delta.seconds/60)
18 elif delta.seconds / 60 / 60 < 24:
19- return _(u'%s hours ago' % (delta.seconds/60/60))
20+ return ungettext(u'an hour ago', u'%s hours ago', delta.seconds/60/60)
21 return naturalday(value, arg)
Back to Top