|
3 | 3 |
|
4 | 4 | from datetime import datetime
|
5 | 5 |
|
6 |
| -from django.utils.translation import ungettext, ugettext as _ |
7 | 6 | from django.utils.timezone import now
|
| 7 | +from django.utils.translation import gettext as _ |
| 8 | +from django.utils.translation import ngettext |
8 | 9 |
|
9 | 10 |
|
10 | 11 | def pluralize_year(n):
|
11 | 12 | """Return a string with the number of yeargs ago."""
|
12 |
| - return ungettext(_('{num} year ago'), _('{num} years ago'), n) |
| 13 | + return ngettext(_('{num} year ago'), _('{num} years ago'), n) |
13 | 14 |
|
14 | 15 |
|
15 | 16 | def pluralize_month(n):
|
16 | 17 | """Return a string with the number of months ago."""
|
17 |
| - return ungettext(_('{num} month ago'), _('{num} months ago'), n) |
| 18 | + return ngettext(_('{num} month ago'), _('{num} months ago'), n) |
18 | 19 |
|
19 | 20 |
|
20 | 21 | def pluralize_week(n):
|
21 | 22 | """Return a string with the number of weeks ago."""
|
22 |
| - return ungettext(_('{num} week ago'), _('{num} weeks ago'), n) |
| 23 | + return ngettext(_('{num} week ago'), _('{num} weeks ago'), n) |
23 | 24 |
|
24 | 25 |
|
25 | 26 | def pluralize_day(n):
|
26 | 27 | """Return a string with the number of days ago."""
|
27 |
| - return ungettext(_('{num} day ago'), _('{num} days ago'), n) |
| 28 | + return ngettext(_('{num} day ago'), _('{num} days ago'), n) |
28 | 29 |
|
29 | 30 |
|
30 | 31 | OLDER_CHUNKS = (
|
@@ -57,19 +58,19 @@ def naturaldate(date, include_seconds=False):
|
57 | 58 | if days == 0:
|
58 | 59 | if hours == 0:
|
59 | 60 | if minutes > 0:
|
60 |
| - return ungettext( |
| 61 | + return ngettext( |
61 | 62 | _('{minutes} minute ago'),
|
62 | 63 | _('{minutes} minutes ago'), minutes
|
63 | 64 | ).format(minutes=minutes)
|
64 | 65 | else:
|
65 | 66 | if include_seconds and seconds:
|
66 |
| - return ungettext( |
| 67 | + return ngettext( |
67 | 68 | _('{seconds} second ago'),
|
68 | 69 | _('{seconds} seconds ago'), seconds
|
69 | 70 | ).format(seconds=seconds)
|
70 | 71 | return _('just now')
|
71 | 72 | else:
|
72 |
| - return ungettext( |
| 73 | + return ngettext( |
73 | 74 | _('{hours} hour ago'), _('{hours} hours ago'), hours
|
74 | 75 | ).format(hours=hours)
|
75 | 76 |
|
|
0 commit comments