/** * @param Entity\Note $note * @param array $users * @param Entity\User $owner * @param string $subject * @param string $title * @return void */ protected function sendNoteGroupMail(Entity\Note $note, array $users, Entity\User $owner, $subject, $title) { /** @var Entity\User $user */ foreach ($users as $user) { if ($user->getId() != $owner->getId() && true === $user->getNotifications()) { $this->translator->setLocale($user->getLanguage()); $subject = $this->translator->translate($subject); $content = new ViewModel(); $content->setTemplate('mail/note.phtml')->setVariable('title', $title)->setVariable('note', $note)->setVariable('host', $this->host); $message = $this->SxMail->compose($content); $message->addTo($user->getEmail()); $message->addFrom($this->defaultFrom); $message->setSubject($subject); $this->SxMail->send($message); } } // @todo this will only work, as long owner is the only one with edit permissions $this->translator->setLocale($owner->getLanguage()); return; }
public function onChangeLocation(MvcEvent $e) { $locale = $this->translator->getLocale(); $this->translator->setLocale($e->getRouteMatch()->getParam('lang')); $this->translator->setFallbackLocale($locale); }