summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-04-26 09:27:55 +0200
committerJoas Schilling <coding@schilljs.com>2017-04-26 09:34:59 +0200
commit6c28c4ac8be4f296696d820798982d9a28f952c1 (patch)
tree0e9755545b5effe3934b2c9808be52eade72b35f /apps
parentf43e7a9405cbc0d469d29060f7f37a6eb0055988 (diff)
downloadnextcloud-server-6c28c4ac8be4f296696d820798982d9a28f952c1.tar.gz
nextcloud-server-6c28c4ac8be4f296696d820798982d9a28f952c1.zip
Use correct plural form and add special strings for tomorrow and today
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/lib/Notification/Notifier.php14
-rw-r--r--apps/user_ldap/lib/User/User.php2
2 files changed, 14 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/Notification/Notifier.php b/apps/user_ldap/lib/Notification/Notifier.php
index a6053cfcb19..0099d764f03 100644
--- a/apps/user_ldap/lib/Notification/Notifier.php
+++ b/apps/user_ldap/lib/Notification/Notifier.php
@@ -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:
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php
index a9e7eb6cc0c..5017f35ed0a 100644
--- a/apps/user_ldap/lib/User/User.php
+++ b/apps/user_ldap/lib/User/User.php
@@ -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);
}