FileTranslation::filesToArray

public static FileTranslation::filesToArray($langcode, array $files)

Reads the given Gettext PO files into a data structure.

Parameters

string $langcode: Language code string.

array $files: List of file objects with URI properties pointing to read.

Return value

array Structured array as produced by a PoMemoryWriter.

See also

\Drupal\Component\Gettext\PoMemoryWriter

File

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

Class

FileTranslation
File based string translation.

Namespace

Drupal\Core\StringTranslation\Translator

Code

public static function filesToArray($langcode, array $files) {
  $writer = new PoMemoryWriter();
  $writer->setLangcode($langcode);
  foreach ($files as $file) {
    $reader = new PoStreamReader();
    $reader->setURI($file->uri);
    $reader->setLangcode($langcode);
    $reader->open();
    $writer->writeItems($reader, -1);
  }
  return $writer->getData();
}
doc_Drupal
2016-10-29 09:14:03
Comments
Leave a Comment

Please login to continue.