function TranslationManager::addTranslator

Same name in other branches
  1. 9 core/lib/Drupal/Core/StringTranslation/TranslationManager.php \Drupal\Core\StringTranslation\TranslationManager::addTranslator()
  2. 8.9.x core/lib/Drupal/Core/StringTranslation/TranslationManager.php \Drupal\Core\StringTranslation\TranslationManager::addTranslator()
  3. 11.x core/lib/Drupal/Core/StringTranslation/TranslationManager.php \Drupal\Core\StringTranslation\TranslationManager::addTranslator()

Appends a translation system to the translation chain.

Parameters

\Drupal\Core\StringTranslation\Translator\TranslatorInterface $translator: The translation interface to be appended to the translation chain.

int $priority: The priority of the logger being added.

Return value

$this

File

core/lib/Drupal/Core/StringTranslation/TranslationManager.php, line 66

Class

TranslationManager
Defines a chained translation implementation combining multiple translators.

Namespace

Drupal\Core\StringTranslation

Code

public function addTranslator(TranslatorInterface $translator, $priority = 0) {
    $this->translators[$priority][] = $translator;
    // Reset sorted translators property to trigger rebuild.
    $this->sortedTranslators = NULL;
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.