function TranslationManager::sortTranslators

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

Sorts translators according to priority.

Return value

\Drupal\Core\StringTranslation\Translator\TranslatorInterface[] A sorted array of translator objects.

2 calls to TranslationManager::sortTranslators()
TranslationManager::getStringTranslation in core/lib/Drupal/Core/StringTranslation/TranslationManager.php
Retrieves English string to given language.
TranslationManager::reset in core/lib/Drupal/Core/StringTranslation/TranslationManager.php
Resets translation cache.

File

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

Class

TranslationManager
Defines a chained translation implementation combining multiple translators.

Namespace

Drupal\Core\StringTranslation

Code

protected function sortTranslators() {
    krsort($this->translators);
    return array_merge(...$this->translators);
}

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