Use correct plural form and add special strings for tomorrow and today
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
f43e7a9405
commit
6c28c4ac8b
2 changed files with 14 additions and 2 deletions
|
@ -60,7 +60,19 @@ class Notifier implements INotifier {
|
|||
switch ($notification->getSubject()) {
|
||||
// Deal with known subjects
|
||||
case 'pwd_exp_warn_days':
|
||||
$notification->setParsedSubject($l->t('Your password will expire within %s day(s).', $notification->getSubjectParameters()));
|
||||
$params = $notification->getSubjectParameters();
|
||||
$days = (int) $params[0];
|
||||
if ($days === 2) {
|
||||
$notification->setParsedSubject($l->t('Your password will expire tomorrow.', $days));
|
||||
} else if ($days === 1) {
|
||||
$notification->setParsedSubject($l->t('Your password will expire today.', $days));
|
||||
} else {
|
||||
$notification->setParsedSubject($l->n(
|
||||
'Your password will expire within %n day.',
|
||||
'Your password will expire within %n days.',
|
||||
$days
|
||||
));
|
||||
}
|
||||
return $notification;
|
||||
|
||||
default:
|
||||
|
|
|
@ -683,7 +683,7 @@ class User {
|
|||
->setUser($uid)
|
||||
->setDateTime($currentDateTime)
|
||||
->setObject('pwd_exp_warn', $uid)
|
||||
->setSubject('pwd_exp_warn_days', [strval(ceil($secondsToExpiry / 60 / 60 / 24))])
|
||||
->setSubject('pwd_exp_warn_days', [(int) ceil($secondsToExpiry / 60 / 60 / 24)])
|
||||
;
|
||||
$this->notificationManager->notify($notification);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue