1
1
Fork 0

Merge pull request #5922 from JonnyTischbein/issue_delete_since

Admin: Change User deleted since to delete in
This commit is contained in:
Hypolite Petovan 2018-10-14 17:17:18 -04:00 committed by GitHub
commit ce8b0d0c45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View file

@ -1922,7 +1922,7 @@ function admin_page_users(App $a)
'$h_users' => L10n::t('Users'), '$h_users' => L10n::t('Users'),
'$h_newuser' => L10n::t('New User'), '$h_newuser' => L10n::t('New User'),
'$th_deleted' => [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Deleted since')], '$th_deleted' => [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Delete in')],
'$th_users' => $th_users, '$th_users' => $th_users,
'$order_users' => $order, '$order_users' => $order,
'$order_direction_users' => $order_direction, '$order_direction_users' => $order_direction,

View file

@ -294,12 +294,18 @@ class Temporal
return L10n::t('never'); return L10n::t('never');
} }
$isfuture = false;
$etime = time() - $abs; $etime = time() - $abs;
if ($etime < 1) { if ($etime < 1 && $etime >= 0) {
return L10n::t('less than a second ago'); return L10n::t('less than a second ago');
} }
if ($etime < 0){
$etime = -$etime;
$isfuture = true;
}
$a = [12 * 30 * 24 * 60 * 60 => [L10n::t('year'), L10n::t('years')], $a = [12 * 30 * 24 * 60 * 60 => [L10n::t('year'), L10n::t('years')],
30 * 24 * 60 * 60 => [L10n::t('month'), L10n::t('months')], 30 * 24 * 60 * 60 => [L10n::t('month'), L10n::t('months')],
7 * 24 * 60 * 60 => [L10n::t('week'), L10n::t('weeks')], 7 * 24 * 60 * 60 => [L10n::t('week'), L10n::t('weeks')],
@ -315,7 +321,12 @@ class Temporal
$r = round($d); $r = round($d);
// translators - e.g. 22 hours ago, 1 minute ago // translators - e.g. 22 hours ago, 1 minute ago
if (!$format) { if (!$format) {
$format = L10n::t('%1$d %2$s ago'); if($isfuture){
$format = L10n::t('in %1$d %2$s');
}
else {
$format = L10n::t('%1$d %2$s ago');
}
} }
return sprintf($format, $r, (($r == 1) ? $str[0] : $str[1])); return sprintf($format, $r, (($r == 1) ? $str[0] : $str[1]));