function TranslationManager::sortTranslators

Same name in other branches
  1. 9 core/lib/Drupal/Core/StringTranslation/TranslationManager.php \Drupal\Core\StringTranslation\TranslationManager::sortTranslators()
  2. 10 core/lib/Drupal/Core/StringTranslation/TranslationManager.php \Drupal\Core\StringTranslation\TranslationManager::sortTranslators()
  3. 11.x 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() {
    $sorted = [];
    krsort($this->translators);
    foreach ($this->translators as $translators) {
        $sorted = array_merge($sorted, $translators);
    }
    return $sorted;
}

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