You are here

protected function FileTranslation::getLanguage in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php \Drupal\Core\StringTranslation\Translator\FileTranslation::getLanguage()

Add translations for new language.

Parameters

string $langcode: The langcode of the language.

Overrides StaticTranslation::getLanguage

File

core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php, line 44
Contains \Drupal\Core\StringTranslation\Translator\FileTranslation.

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 array();
  }
}