Skip to content

Emails sent from custom module are not translated

I have the following code:

$this->transportBuilder->setTemplateIdentifier('promo_new_account_coupon')
                       ->setTemplateOptions(
                           [
                               'area'  => 'frontend',
                               'store' => 1,
                           ]
                       )
                       ->setTemplateVars([
                                             'customer' => $customerFullName,
                                         ])
                       ->setFrom('sales')
                       ->addTo($customerEmail, $customerFullName);

$this->transportBuilder->getTransport()
                       ->sendMessage();

But emails are never translated. They are sent in the default language and not in the one defined in the store ‘1’ settings.