You are here

public function TranslationManager::addTranslator in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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

\Drupal\Core\StringTranslation\TranslationManager The called object.

File

core/lib/Drupal/Core/StringTranslation/TranslationManager.php, line 68
Contains \Drupal\Core\StringTranslation\TranslationManager.

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;
}