sortTranslators example


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

  /** * {@inheritdoc} */
  public function getStringTranslation($langcode$string$context) {
    if ($this->sortedTranslators === NULL) {
      $this->sortedTranslators = $this->sortTranslators();
    }
    foreach ($this->sortedTranslators as $translator) {
      $translation = $translator->getStringTranslation($langcode$string$context);
      if ($translation !== FALSE) {
        return $translation;
      }
    }
    // No translator got a translation.     return FALSE;
  }

  
Home | Imprint | This part of the site doesn't use cookies.