class PoDatabaseWriter implements PoWriterInterface (View source)

Gettext PO writer working with the locale module database.

Methods

__construct()

Constructor, initialize reporting array.

string
getLangcode()

Get language code.

setLangcode(string $langcode)

Set language code.

getReport()

Get the report of the write operations.

setReport(array $report = [])

Set the report array of write operations.

getOptions()

Get the options used by the writer.

setOptions(array $options)

Set the options for the current writer.

getHeader()

Get header metadata.

setHeader(PoHeader $header)

Implements Drupal\Component\Gettext\PoMetadataInterface::setHeader().

writeItem(PoItem $item)

Writes the given item.

writeItems(PoReaderInterface $reader, $count = -1)

Writes all or the given amount of items.

Details

__construct()

Constructor, initialize reporting array.

string getLangcode()

Get language code.

Return Value

string

Language code string.

setLangcode(string $langcode)

Set language code.

Parameters

string $langcode

Language code string.

getReport()

Get the report of the write operations.

setReport(array $report = [])

Set the report array of write operations.

Parameters

array $report

Associative array with result information.

getOptions()

Get the options used by the writer.

setOptions(array $options)

Set the options for the current writer.

Parameters

array $options

An associative array containing:

  • overwrite_options: An array of options. Each option contains:
    • not_customized: Boolean indicating that not customized strings should be overwritten.
    • customized: Boolean indicating that customized strings should be overwritten.
  • customized: The strings being imported should be saved as customized. One of LOCALE_CUSTOMIZED or LOCALE_NOT_CUSTOMIZED.

PoHeader getHeader()

Get header metadata.

Return Value

PoHeader

Header instance representing metadata in a PO header.

setHeader(PoHeader $header)

Implements Drupal\Component\Gettext\PoMetadataInterface::setHeader().

Sets the header and configure Drupal accordingly.

Before being able to process the given header we need to know in what context this database write is done. For this the options must be set.

A langcode is required to set the current header's PluralForm.

Parameters

PoHeader $header

Header object representing metadata in a PO header.

Exceptions

Exception

writeItem(PoItem $item)

Writes the given item.

Parameters

PoItem $item

One specific item to write.

writeItems(PoReaderInterface $reader, $count = -1)

Writes all or the given amount of items.

Parameters

PoReaderInterface $reader

Reader to read PoItems from.

$count

Amount of items to read from $reader to write. If -1, all items are read from $reader.