function StaticTranslation::getLanguage

Same name in other branches
  1. 9 core/lib/Drupal/Core/StringTranslation/Translator/StaticTranslation.php \Drupal\Core\StringTranslation\Translator\StaticTranslation::getLanguage()
  2. 8.9.x core/lib/Drupal/Core/StringTranslation/Translator/StaticTranslation.php \Drupal\Core\StringTranslation\Translator\StaticTranslation::getLanguage()
  3. 11.x core/lib/Drupal/Core/StringTranslation/Translator/StaticTranslation.php \Drupal\Core\StringTranslation\Translator\StaticTranslation::getLanguage()

Retrieves translations for a given language.

Parameters

string $langcode: The langcode of the language.

Return value

array A multidimensional array of translations, indexed by the context the source string belongs to. The second level is using original strings as keys. An empty array will be returned when no translations are available.

1 call to StaticTranslation::getLanguage()
StaticTranslation::getStringTranslation in core/lib/Drupal/Core/StringTranslation/Translator/StaticTranslation.php
Retrieves English string to given language.
2 methods override StaticTranslation::getLanguage()
CustomStrings::getLanguage in core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php
Retrieves translations for a given language.
FileTranslation::getLanguage in core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php
Retrieves translations for a given language.

File

core/lib/Drupal/Core/StringTranslation/Translator/StaticTranslation.php, line 63

Class

StaticTranslation
String translator with a static cache for translations.

Namespace

Drupal\Core\StringTranslation\Translator

Code

protected function getLanguage($langcode) {
    // This class is usually a base class but we do not declare as abstract
    // because it can be used on its own, by passing a simple array on the
    // constructor. This can be useful while testing, but it does not support
    // loading specific languages. All available languages should be passed
    // in the constructor array.
    return [];
}

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