static function Gettext::filesToArray

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

1 call to Gettext::filesToArray()
st in drupal/core/includes/install.inc
Translates a string when some systems are not available.

File

drupal/core/modules/locale/lib/Drupal/locale/Gettext.php, line 38
Definition of Drupal\locale\Gettext.

Class

Gettext
Static class providing Drupal specific Gettext functionality.

Namespace

Drupal\locale

Code

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