You are here

protected function TranslationManager::sortTranslators in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/StringTranslation/TranslationManager.php \Drupal\Core\StringTranslation\TranslationManager::sortTranslators()
  2. 9 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);
}