Merge pull request #4512 from nextcloud/fix-translations-2

Fix translations
This commit is contained in:
Morris Jobke 2017-04-26 08:57:08 -03:00 committed by GitHub
commit ba43a09380
4 changed files with 19 additions and 7 deletions

View File

@ -173,17 +173,17 @@ class Activity implements IProvider {
->setRichSubject($this->l->t('{actor} shared {file} with {email} by mail'), $parsedParameters) ->setRichSubject($this->l->t('{actor} shared {file} with {email} by mail'), $parsedParameters)
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) { } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) {
$event->setParsedSubject($this->l->t('Password to access %1$s was send to %2s', [ $event->setParsedSubject($this->l->t('Password to access %1$s was sent to %2s', [
$parsedParameters['file']['path'], $parsedParameters['file']['path'],
$parsedParameters['email']['name'] $parsedParameters['email']['name']
])) ]))
->setRichSubject($this->l->t('Password to access {file} was send to {email}'), $parsedParameters) ->setRichSubject($this->l->t('Password to access {file} was sent to {email}'), $parsedParameters)
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) { } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) {
$event->setParsedSubject( $event->setParsedSubject(
$this->l->t('Password to access %1$s was send to you', $this->l->t('Password to access %1$s was sent to you',
[$parsedParameters['file']['path']])) [$parsedParameters['file']['path']]))
->setRichSubject($this->l->t('Password to access {file} was send to you'), $parsedParameters) ->setRichSubject($this->l->t('Password to access {file} was sent to you'), $parsedParameters)
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
} else { } else {

View File

@ -60,7 +60,19 @@ class Notifier implements INotifier {
switch ($notification->getSubject()) { switch ($notification->getSubject()) {
// Deal with known subjects // Deal with known subjects
case 'pwd_exp_warn_days': 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; return $notification;
default: default:

View File

@ -683,7 +683,7 @@ class User {
->setUser($uid) ->setUser($uid)
->setDateTime($currentDateTime) ->setDateTime($currentDateTime)
->setObject('pwd_exp_warn', $uid) ->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); $this->notificationManager->notify($notification);
} }

View File

@ -160,7 +160,7 @@ class MailSettingsController extends Controller {
$message->setPlainBody($template->renderText()); $message->setPlainBody($template->renderText());
$errors = $this->mailer->send($message); $errors = $this->mailer->send($message);
if (!empty($errors)) { if (!empty($errors)) {
throw new \RuntimeException($this->l10n->t('Mail could not be sent. Check your mail server log')); throw new \RuntimeException($this->l10n->t('Email could not be sent. Check your mail server log'));
} }
return new DataResponse(); return new DataResponse();
} catch (\Exception $e) { } catch (\Exception $e) {