translate phrases in getPeriodOfTime()

This commit is contained in:
Uwe Steinmann 2020-12-07 20:43:27 +01:00
parent 1b79a422e1
commit f70973e80d

View File

@ -53,19 +53,19 @@ function getPeriodOfTime($timestamp) { /* {{{ */
$time = time() - $timestamp; // to get the time since that moment
$time = ($time<1)? 1 : $time;
$tokens = array (
31536000 => getMLText('abbr_year'),
2592000 => getMLText('abbr_month'),
604800 => getMLText('abbr_week'),
86400 => getMLText('abbr_day'),
3600 => getMLText('abbr_hour'),
60 => getMLText('abbr_minute'),
1 => getMLText('abbr_second')
31536000 => 'abbr_year',
2592000 => 'abbr_month',
604800 => 'abbr_week',
86400 => 'abbr_day',
3600 => 'abbr_hour',
60 => 'abbr_minute',
1 => 'abbr_second'
);
foreach ($tokens as $unit => $text) {
if ($time < $unit) continue;
$numberOfUnits = floor($time / $unit);
return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':'');
return $numberOfUnits.' '.(($numberOfUnits>1) ? getMLText($text):getMLText($text));
}
} /* }}} */