function FileTranslation::getLanguage

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

Overrides StaticTranslation::getLanguage

File

core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php, line 55

Class

FileTranslation
File based string translation.

Namespace

Drupal\Core\StringTranslation\Translator

Code

protected function getLanguage($langcode) {
    // If the given langcode was selected, there should be at least one .po
    // file with its name in the pattern drupal-$version.$langcode.po.
    // This might or might not be the entire filename. It is also possible
    // that multiple files end with the same suffix, even if unlikely.
    $files = $this->findTranslationFiles($langcode);
    if (!empty($files)) {
        return $this->filesToArray($langcode, $files);
    }
    else {
        return [];
    }
}

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