You are here

protected function LanguageAwareSendMailQueueWorker::setNegotiatorLanguage in Queue Mail 8

Sets the queue mail negotiator language.

Parameters

string $langcode: The new language code.

2 calls to LanguageAwareSendMailQueueWorker::setNegotiatorLanguage()
LanguageAwareSendMailQueueWorker::setActiveLanguage in modules/queue_mail_language/src/Plugin/QueueWorker/LanguageAwareSendMailQueueWorker.php
Restores back the negotiated language.
LanguageAwareSendMailQueueWorker::setMailLanguage in modules/queue_mail_language/src/Plugin/QueueWorker/LanguageAwareSendMailQueueWorker.php
Sets language from the message.

File

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

Class

LanguageAwareSendMailQueueWorker
Sends emails from queue with language support.

Namespace

Drupal\queue_mail_language\Plugin\QueueWorker

Code

protected function setNegotiatorLanguage($langcode) {
  if ($this->languageManager
    ->getNegotiator() !== $this->queueMailLanguageNegotiator) {
    $this->languageManager
      ->setNegotiator($this->queueMailLanguageNegotiator);
  }
  $this->queueMailLanguageNegotiator
    ->setLanguageCode($langcode);

  // Needed to re-run language negotiation.
  $this->languageManager
    ->reset();
}