diff options
author | dartcafe <github@dartcafe.de> | 2022-01-28 10:31:02 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2022-01-28 10:31:02 +0300 |
commit | bfd5a6b736ff47c822ccb921171576aa29e1ddbb (patch) | |
tree | 6171036673ad05dbc245adc7e69531ea2b3f624d /lib | |
parent | 22340d5a41044e1c0e79399e0fb906e794c8ff2d (diff) |
minimize the merge conflict
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Model/Mail/InvitationMail.php | 12 | ||||
-rw-r--r-- | lib/Model/Mail/MailBase.php | 10 | ||||
-rw-r--r-- | lib/Model/Mail/NotificationMail.php | 54 | ||||
-rw-r--r-- | lib/Model/Mail/ReminderMail.php | 18 |
4 files changed, 47 insertions, 47 deletions
diff --git a/lib/Model/Mail/InvitationMail.php b/lib/Model/Mail/InvitationMail.php index 8ccd5381..1793b9b2 100644 --- a/lib/Model/Mail/InvitationMail.php +++ b/lib/Model/Mail/InvitationMail.php @@ -41,11 +41,11 @@ class InvitationMail extends MailBase { } protected function getSubject(): string { - return $this->trans->t('Poll invitation "%s"', $this->poll->getTitle()); + return $this->l10n->t('Poll invitation "%s"', $this->poll->getTitle()); } protected function getFooter(): string { - return $this->trans->t('This email is sent to you, because you are invited to vote in this poll by the poll owner. At least your name or your email address is recorded in this poll. If you want to get removed from this poll, contact the site administrator or the initiator of this poll, where the mail is sent from.'); + return $this->l10n->t('This email is sent to you, because you are invited to vote in this poll by the poll owner. At least your name or your email address is recorded in this poll. If you want to get removed from this poll, contact the site administrator or the initiator of this poll, where the mail is sent from.'); } protected function buildBody(): void { @@ -53,13 +53,13 @@ class InvitationMail extends MailBase { $this->emailTemplate->addBodyText(str_replace( ['{owner}', '{title}', '{group_name}'], [$this->owner->getDisplayName(), $this->poll->getTitle(), $this->share->getDisplayName()], - $this->trans->t('{owner} invited you to take part in the poll "{title}" as a member of the group {group_name}') + $this->l10n->t('{owner} invited you to take part in the poll "{title}" as a member of the group {group_name}') )); } else { $this->emailTemplate->addBodyText(str_replace( ['{owner}', '{title}'], [$this->owner->getDisplayName(), $this->poll->getTitle()], - $this->trans->t('{owner} invited you to take part in the poll "{title}"') + $this->l10n->t('{owner} invited you to take part in the poll "{title}"') )); } @@ -69,8 +69,8 @@ class InvitationMail extends MailBase { $this->emailTemplate->addBodyButton($this->getButtonText(), $this->url); } - $this->emailTemplate->addBodyText($this->trans->t('This link gives you personal access to the poll named above. Press the button above or copy the following link and add it in your browser\'s location bar:')); + $this->emailTemplate->addBodyText($this->l10n->t('This link gives you personal access to the poll named above. Press the button above or copy the following link and add it in your browser\'s location bar:')); $this->emailTemplate->addBodyText($this->url); - $this->emailTemplate->addBodyText($this->trans->t('Do not share this link with other people, because it is connected to your votes.')); + $this->emailTemplate->addBodyText($this->l10n->t('Do not share this link with other people, because it is connected to your votes.')); } } diff --git a/lib/Model/Mail/MailBase.php b/lib/Model/Mail/MailBase.php index 58f354fa..fe8376d5 100644 --- a/lib/Model/Mail/MailBase.php +++ b/lib/Model/Mail/MailBase.php @@ -63,7 +63,7 @@ abstract class MailBase { protected $mailer; /** @var IL10N */ - protected $trans; + protected $l10n; /** @var IFactory */ protected $transFactory; @@ -116,7 +116,7 @@ abstract class MailBase { $this->url = $this->getShareURL(); } - $this->trans = $this->transFactory->get( + $this->l10n = $this->transFactory->get( 'polls', $this->recipient->getLanguage() ? $this->recipient->getLanguage() @@ -148,7 +148,7 @@ abstract class MailBase { } protected function getSubject(): string { - return $this->trans->t('Notification for poll "%s"', $this->poll->getTitle()); + return $this->l10n->t('Notification for poll "%s"', $this->poll->getTitle()); } protected function getHeading(): string { @@ -156,11 +156,11 @@ abstract class MailBase { } protected function getButtonText(): string { - return $this->trans->t('Go to poll'); + return $this->l10n->t('Go to poll'); } protected function getFooter(): string { - return $this->trans->t('This email is sent to you, because you subscribed to notifications of this poll. To opt out, visit the poll and remove your subscription.'); + return $this->l10n->t('This email is sent to you, because you subscribed to notifications of this poll. To opt out, visit the poll and remove your subscription.'); } protected function buildBody(): void { diff --git a/lib/Model/Mail/NotificationMail.php b/lib/Model/Mail/NotificationMail.php index df266e91..3b6d6d45 100644 --- a/lib/Model/Mail/NotificationMail.php +++ b/lib/Model/Mail/NotificationMail.php @@ -47,24 +47,24 @@ class NotificationMail extends MailBase { } protected function getSubject(): string { - return $this->trans->t('Polls App - New Activity'); + return $this->l10n->t('Polls App - New Activity'); } protected function getFooter(): string { - return $this->trans->t('This email is sent to you, because you subscribed to notifications of this poll. To opt out, visit the poll and remove your subscription.'); + return $this->l10n->t('This email is sent to you, because you subscribed to notifications of this poll. To opt out, visit the poll and remove your subscription.'); } protected function buildBody(): void { $this->emailTemplate->addBodyText(str_replace( ['{title}'], [$this->poll->getTitle()], - $this->trans->t('"{title}" has recent activity:') + $this->l10n->t('"{title}" has recent activity:') )); foreach ($this->subscription->getNotifyLogs() as $logItem) { if ($this->poll->getAnonymous() || $this->poll->getShowResults() !== "always") { // hide actor's name if poll is anonymous or results are hidden - $displayName = $this->trans->t('A user'); + $displayName = $this->l10n->t('A user'); } else { $displayName = $this->getUser($logItem->getUserId())->getDisplayName(); } @@ -77,29 +77,29 @@ class NotificationMail extends MailBase { private function getComposedLogString(Log $logItem, string $displayName): string { $logStrings = [ - Log::MSG_ID_SETVOTE => $this->trans->t('%s has voted.', [$displayName]), - Log::MSG_ID_UPDATEPOLL => $this->trans->t('Updated poll configuration. Please check your votes.'), - Log::MSG_ID_DELETEPOLL => $this->trans->t('The poll has been deleted.'), - Log::MSG_ID_RESTOREPOLL => $this->trans->t('The poll has been restored.'), - Log::MSG_ID_EXPIREPOLL => $this->trans->t('The poll has been closed.'), - Log::MSG_ID_ADDOPTION => $this->trans->t('A voting option has been added.'), - Log::MSG_ID_UPDATEOPTION => $this->trans->t('A voting option has been changed.'), - Log::MSG_ID_CONFIRMOPTION => $this->trans->t('A voting option has been confirmed.'), - Log::MSG_ID_DELETEOPTION => $this->trans->t('A voting option has been removed.'), - Log::MSG_ID_OWNERCHANGE => $this->trans->t('The poll owner has been changed.'), - Log::MSG_ID_ADDPOLL => $this->trans->t('%s created the poll.', [$displayName]), - PollEvent::ADD => $this->trans->t('%s created the poll.', [$displayName]), - PollEvent::UPDATE => $this->trans->t('Updated poll configuration. Please check your votes.'), - PollEvent::DELETE => $this->trans->t('The poll has been deleted.'), - PollEvent::RESTORE => $this->trans->t('The poll has been restored.'), - PollEvent::EXPIRE => $this->trans->t('The poll has been closed.'), - PollEvent::OWNER_CHANGE => $this->trans->t('The poll owner has been changed.'), - OptionEvent::ADD => $this->trans->t('A voting option has been added.'), - OptionEvent::UPDATE => $this->trans->t('A voting option has been changed.'), - OptionEvent::CONFIRM => $this->trans->t('A voting option has been confirmed.'), - OptionEvent::UNCONFIRM => $this->trans->t('A voting option has been unconfirmed.'), - OptionEvent::DELETE => $this->trans->t('A voting option has been removed.'), - VoteEvent::SET => $this->trans->t('%s has voted.', [$displayName]), + Log::MSG_ID_SETVOTE => $this->l10n->t('%s has voted.', [$displayName]), + Log::MSG_ID_UPDATEPOLL => $this->l10n->t('Updated poll configuration. Please check your votes.'), + Log::MSG_ID_DELETEPOLL => $this->l10n->t('The poll has been deleted.'), + Log::MSG_ID_RESTOREPOLL => $this->l10n->t('The poll has been restored.'), + Log::MSG_ID_EXPIREPOLL => $this->l10n->t('The poll has been closed.'), + Log::MSG_ID_ADDOPTION => $this->l10n->t('A voting option has been added.'), + Log::MSG_ID_UPDATEOPTION => $this->l10n->t('A voting option has been changed.'), + Log::MSG_ID_CONFIRMOPTION => $this->l10n->t('A voting option has been confirmed.'), + Log::MSG_ID_DELETEOPTION => $this->l10n->t('A voting option has been removed.'), + Log::MSG_ID_OWNERCHANGE => $this->l10n->t('The poll owner has been changed.'), + Log::MSG_ID_ADDPOLL => $this->l10n->t('%s created the poll.', [$displayName]), + PollEvent::ADD => $this->l10n->t('%s created the poll.', [$displayName]), + PollEvent::UPDATE => $this->l10n->t('Updated poll configuration. Please check your votes.'), + PollEvent::DELETE => $this->l10n->t('The poll has been deleted.'), + PollEvent::RESTORE => $this->l10n->t('The poll has been restored.'), + PollEvent::EXPIRE => $this->l10n->t('The poll has been closed.'), + PollEvent::OWNER_CHANGE => $this->l10n->t('The poll owner has been changed.'), + OptionEvent::ADD => $this->l10n->t('A voting option has been added.'), + OptionEvent::UPDATE => $this->l10n->t('A voting option has been changed.'), + OptionEvent::CONFIRM => $this->l10n->t('A voting option has been confirmed.'), + OptionEvent::UNCONFIRM => $this->l10n->t('A voting option has been unconfirmed.'), + OptionEvent::DELETE => $this->l10n->t('A voting option has been removed.'), + VoteEvent::SET => $this->l10n->t('%s has voted.', [$displayName]), ]; return $logStrings[$logItem->getMessageId()] ?? $logItem->getMessageId() . " (" . $displayName . ")"; diff --git a/lib/Model/Mail/ReminderMail.php b/lib/Model/Mail/ReminderMail.php index 0855e7c0..b932300d 100644 --- a/lib/Model/Mail/ReminderMail.php +++ b/lib/Model/Mail/ReminderMail.php @@ -56,47 +56,47 @@ class ReminderMail extends MailBase { } protected function getSubject(): string { - return $this->trans->t('Reminder for poll "%s"', $this->poll->getTitle()); + return $this->l10n->t('Reminder for poll "%s"', $this->poll->getTitle()); } protected function getButtonText(): string { - return $this->trans->t('Check your votes'); + return $this->l10n->t('Check your votes'); } protected function getFooter(): string { - return $this->trans->t('This email is sent to you, because you are invited to vote in this poll by the poll owner. At least your name or your email address is recorded in this poll. If you want to get removed from this poll, contact the site administrator or the initiator of this poll, where the mail is sent from.'); + return $this->l10n->t('This email is sent to you, because you are invited to vote in this poll by the poll owner. At least your name or your email address is recorded in this poll. If you want to get removed from this poll, contact the site administrator or the initiator of this poll, where the mail is sent from.'); } protected function buildBody(): void { $dtDeadline = new DateTime('now', $this->recipient->getTimeZone()); $dtDeadline->setTimestamp($this->deadline); - $deadlineText = (string) $this->trans->l('datetime', $dtDeadline, ['width' => 'long']); + $deadlineText = (string) $this->l10n->l('datetime', $dtDeadline, ['width' => 'long']); if ($this->getReminderReason() === self::REASON_OPTION) { $this->emailTemplate->addBodyText(str_replace( ['{leftPeriod}', '{dateTime}', '{timezone}'], [($this->timeToDeadline / 3600), $deadlineText, $this->recipient->getTimeZone()->getName()], - $this->trans->t('The first poll option is away less than {leftPeriod} hours ({dateTime}, {timezone}).') + $this->l10n->t('The first poll option is away less than {leftPeriod} hours ({dateTime}, {timezone}).') )); } elseif ($this->getReminderReason() === self::REASON_EXPIRATION) { $this->emailTemplate->addBodyText(str_replace( ['{leftPeriod}', '{dateTime}', '{timezone}'], [($this->timeToDeadline / 3600), $deadlineText, $this->recipient->getTimeZone()->getName()], - $this->trans->t('The poll is about to expire in less than {leftPeriod} hours ({dateTime}, {timezone}).') + $this->l10n->t('The poll is about to expire in less than {leftPeriod} hours ({dateTime}, {timezone}).') )); } else { $this->emailTemplate->addBodyText(str_replace( ['{owner}'], [$this->owner->getDisplayName()], - $this->trans->t('{owner} sends you this reminder to make sure, your votes are set.') + $this->l10n->t('{owner} sends you this reminder to make sure, your votes are set.') )); } $this->emailTemplate->addBodyButton($this->getButtonText(), $this->url); - $this->emailTemplate->addBodyText($this->trans->t('This link gives you personal access to the poll named above. Press the button above or copy the following link and add it in your browser\'s location bar:')); + $this->emailTemplate->addBodyText($this->l10n->t('This link gives you personal access to the poll named above. Press the button above or copy the following link and add it in your browser\'s location bar:')); $this->emailTemplate->addBodyText($this->url); - $this->emailTemplate->addBodyText($this->trans->t('Do not share this link with other people, because it is connected to your votes.')); + $this->emailTemplate->addBodyText($this->l10n->t('Do not share this link with other people, because it is connected to your votes.')); } private function getReminderReason() : ?string { |