Today I ran into a symfony translation problem.
Sent by SwiftMailer, emails are created in a personal service.
case 1: the sendWelcomeEmailMessage function is called in the controller, just when a new user is registered, the transcript "registration.email.welcome.subject" translates well
case 2: function sendReflationEmailMessage is called in the symfony2 command, but here the key 'registration.email.welcome.subject' (the same key for the test) is not translated ...
Does anyone have an idea?
public function sendWelcomeEmailMessage(UserInterface $user)
{
$params = $this->parameters['registration']['welcome'];
$rendered = $this->templating->render(
$params['template'], [
'user' => $user
]
);
$subject = $this->translator->trans('registration.email.welcome.subject');
$this->sendEmailMessage($rendered, $subject, $params['from_email'], $user->getEmail());
}
public function sendReflationEmailMessage(UserInterface $user)
{
$params = $this->parameters['registration']['reflation'];
$rendered = $this->templating->render(
$params['template'], [
'user' => $user
]
);
$subject = $this->translator->trans('registration.email.welcome.subject');
$this->sendEmailMessage($rendered, $subject, $params['from_email'], $user->getEmail());
}
source
share