You are here

protected function TranslationManager::sortTranslators in Drupal 9

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