summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorSiebrand Mazeland <s.mazeland@xs4all.nl>2010-09-13 00:07:43 +0200
committerSiebrand Mazeland <s.mazeland@xs4all.nl>2010-09-13 21:10:51 +0200
commitb27882c9166191de4aaea298ba1b1a524cfe9ac7 (patch)
treeb8837a7f41c186a1ae2af083dbba291678c3b961 /lib/util.php
parent0d1b60b11df70ea97984d857bcab8dd0b694334e (diff)
Add plural support for minutes/hours/days/months ago.
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/util.php b/lib/util.php
index f63e152e3..f547f166c 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -1104,30 +1104,26 @@ function common_date_string($dt)
// TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about a minute ago');
} else if ($diff < 3300) {
- // XXX: should support plural.
// TRANS: Used in notices to indicate when the notice was made compared to now.
- return sprintf(_('about %d minutes ago'), round($diff/60));
+ return sprintf( ngettext('about one minute ago', 'about %d minutes ago'), round($diff/60));
} else if ($diff < 5400) {
// TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about an hour ago');
} else if ($diff < 22 * 3600) {
- // XXX: should support plural.
// TRANS: Used in notices to indicate when the notice was made compared to now.
- return sprintf(_('about %d hours ago'), round($diff/3600));
+ return sprintf( ngettext('about one hour ago', 'about %d hours ago'), round($diff/3600));
} else if ($diff < 37 * 3600) {
// TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about a day ago');
} else if ($diff < 24 * 24 * 3600) {
- // XXX: should support plural.
// TRANS: Used in notices to indicate when the notice was made compared to now.
- return sprintf(_('about %d days ago'), round($diff/(24*3600)));
+ return sprintf( ngettext('about one day ago', 'about %d days ago'), round($diff/(24*3600)));
} else if ($diff < 46 * 24 * 3600) {
// TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about a month ago');
} else if ($diff < 330 * 24 * 3600) {
- // XXX: should support plural.
// TRANS: Used in notices to indicate when the notice was made compared to now.
- return sprintf(_('about %d months ago'), round($diff/(30*24*3600)));
+ return sprintf( ngettext('about one month ago', 'about %d months ago'), round($diff/(30*24*3600)));
} else if ($diff < 480 * 24 * 3600) {
// TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about a year ago');