You are here

public function PoDatabaseWriter::writeItem in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/locale/src/PoDatabaseWriter.php \Drupal\locale\PoDatabaseWriter::writeItem()

Writes the given item.

Parameters

PoItem $item: One specific item to write.

Overrides PoWriterInterface::writeItem

1 call to PoDatabaseWriter::writeItem()
PoDatabaseWriter::writeItems in core/modules/locale/src/PoDatabaseWriter.php
Writes all or the given amount of items.

File

core/modules/locale/src/PoDatabaseWriter.php, line 189

Class

PoDatabaseWriter
Gettext PO writer working with the locale module database.

Namespace

Drupal\locale

Code

public function writeItem(PoItem $item) {
  if ($item
    ->isPlural()) {
    $item
      ->setSource(implode(PoItem::DELIMITER, $item
      ->getSource()));
    $item
      ->setTranslation(implode(PoItem::DELIMITER, $item
      ->getTranslation()));
  }
  $this
    ->importString($item);
}