You are here

protected function LanguageAwareSendMailQueueWorker::setMailLanguage in Queue Mail 8

Sets language from the message.

Parameters

array $message: Mail message.

Return value

string The negotiated language code.

Overrides SendMailQueueWorker::setMailLanguage

File

modules/queue_mail_language/src/Plugin/QueueWorker/LanguageAwareSendMailQueueWorker.php, line 75

Class

LanguageAwareSendMailQueueWorker
Sends emails from queue with language support.

Namespace

Drupal\queue_mail_language\Plugin\QueueWorker

Code

protected function setMailLanguage(array $message) {
  $default_langcode = $this->languageManager
    ->getDefaultLanguage()
    ->getId();
  if ($message['langcode'] !== $default_langcode) {
    $this
      ->setNegotiatorLanguage($message['langcode']);
  }
  return $default_langcode;
}