localise time values

This commit is contained in:
czaks 2013-07-27 01:50:38 -04:00 committed by Michael Foster
parent be2e7d9782
commit babeec8bb9

View File

@ -554,35 +554,35 @@ function checkFlood($post) {
function until($timestamp) {
$difference = $timestamp - time();
if ($difference < 60) {
return $difference . ' second' . ($difference != 1 ? 's' : '');
return $difference . ' ' . ngettext('second', 'seconds', $difference);
} elseif ($difference < 60*60) {
return ($num = round($difference/(60))) . ' minute' . ($num != 1 ? 's' : '');
return ($num = round($difference/(60))) . ' ' . ngettext('minute', 'minutes', $num);
} elseif ($difference < 60*60*24) {
return ($num = round($difference/(60*60))) . ' hour' . ($num != 1 ? 's' : '');
return ($num = round($difference/(60*60))) . ' ' . ngettext('hour', 'hours', $num);
} elseif ($difference < 60*60*24*7) {
return ($num = round($difference/(60*60*24))) . ' day' . ($num != 1 ? 's' : '');
return ($num = round($difference/(60*60*24))) . ' ' . ngettext('day', 'days', $num);
} elseif ($difference < 60*60*24*365) {
return ($num = round($difference/(60*60*24*7))) . ' week' . ($num != 1 ? 's' : '');
return ($num = round($difference/(60*60*24*7))) . ' ' . ngettext('week', 'weeks', $num);
}
return ($num = round($difference/(60*60*24*365))) . ' year' . ($num != 1 ? 's' : '');
return ($num = round($difference/(60*60*24*365))) . ' ' . ngettext('year', 'years', $num);
}
function ago($timestamp) {
$difference = time() - $timestamp;
if ($difference < 60) {
return $difference . ' second' . ($difference != 1 ? 's' : '');
return $difference . ' ' . ngettext('second', 'seconds', $difference);
} elseif ($difference < 60*60) {
return ($num = round($difference/(60))) . ' minute' . ($num != 1 ? 's' : '');
return ($num = round($difference/(60))) . ' ' . ngettext('minute', 'minutes', $num);
} elseif ($difference < 60*60*24) {
return ($num = round($difference/(60*60))) . ' hour' . ($num != 1 ? 's' : '');
return ($num = round($difference/(60*60))) . ' ' . ngettext('hour', 'hours', $num);
} elseif ($difference < 60*60*24*7) {
return ($num = round($difference/(60*60*24))) . ' day' . ($num != 1 ? 's' : '');
return ($num = round($difference/(60*60*24))) . ' ' . ngettext('day', 'days', $num);
} elseif ($difference < 60*60*24*365) {
return ($num = round($difference/(60*60*24*7))) . ' week' . ($num != 1 ? 's' : '');
return ($num = round($difference/(60*60*24*7))) . ' ' . ngettext('week', 'weeks', $num);
}
return ($num = round($difference/(60*60*24*365))) . ' year' . ($num != 1 ? 's' : '');
return ($num = round($difference/(60*60*24*365))) . ' ' . ngettext('year', 'years', $num);
}
function displayBan($ban) {