PoStreamReader
class PoStreamReader implements PoStreamInterface, PoReaderInterface (View source)
Implements Gettext PO stream reader.
The PO file format parsing is implemented according to the documentation at http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files
Properties
| protected int | $lineNumber | Source line number of the stream being parsed. |
|
| protected string | $context | Parser context for the stream reader state machine. |
|
| protected array | $currentItem | Current entry being read. Incomplete. |
|
| protected int | $currentPluralIndex | Current plural index for plural translations. |
|
| protected string | $uri | URI of the PO stream that is being read. |
|
| protected string | $langcode | Language code for the PO stream being read. |
|
| protected resource | $fd | File handle of the current PO stream. |
|
| protected PoHeader | $header | The PO stream header. |
|
| protected PoItem | $lastItem | Object wrapper for the last read source/translation pair. |
|
| protected bool | $finished | Indicator of whether the stream reading is finished. |
|
| protected array | $errors | Array of translated error strings recorded on reading this stream so far. |
Methods
Get language code.
Set language code.
Gets the URI of the PO stream that is being read or written.
Set the URI of the PO stream that is going to be read or written.
Implements Drupal\Component\Gettext\PoStreamInterface::open().
Implements Drupal\Component\Gettext\PoStreamInterface::close().
Sets the seek position for the current PO stream.
Gets the pointer position of the current PO stream.
Store the parsed values as a PoItem object.
Parses a string in quotes.
Details
string
getLangcode()
Get language code.
setLangcode(string $langcode)
Set language code.
PoHeader
getHeader()
Get header metadata.
setHeader(PoHeader $header)
Implements Drupal\Component\Gettext\PoMetadataInterface::setHeader().
Not applicable to stream reading and therefore not implemented.
URI
getURI()
Gets the URI of the PO stream that is being read or written.
setURI($uri)
Set the URI of the PO stream that is going to be read or written.
open()
Implements Drupal\Component\Gettext\PoStreamInterface::open().
Opens the stream and reads the header. The stream is ready for reading items after.
close()
Implements Drupal\Component\Gettext\PoStreamInterface::close().
PoItem
readItem()
Reads and returns a PoItem (source/translation pair).
setSeek(int $seek)
Sets the seek position for the current PO stream.
getSeek()
Gets the pointer position of the current PO stream.
setItemFromArray($value)
Store the parsed values as a PoItem object.
The
parseQuoted($string)
Parses a string in quotes.