private function PoStreamReader::readHeader in Localization update 7.2
Read the header from the PO stream.
The header is a special case PoItem, using the empty string as source and key-value pairs as translation. We just reuse the item reader logic to read the header.
1 call to PoStreamReader::readHeader()
- PoStreamReader::open in includes/
gettext/ PoStreamReader.php - Implements PoStreamInterface::open().
File
- includes/
gettext/ PoStreamReader.php, line 225 - Contains \Drupal\Component\Gettext\PoStreamReader.
Class
- PoStreamReader
- Implements Gettext PO stream reader.
Code
private function readHeader() {
$item = $this
->readItem();
// Handle the case properly when the .po file is empty (0 bytes).
if (!$item) {
return;
}
$header = new PoHeader();
$header
->setFromString(trim($item
->getTranslation()));
$this->_header = $header;
}