You are here

public function PoMemoryWriter::writeItem in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Component/Gettext/PoMemoryWriter.php \Drupal\Component\Gettext\PoMemoryWriter::writeItem()

Writes the given item.

Parameters

PoItem $item: One specific item to write.

Overrides PoWriterInterface::writeItem

1 call to PoMemoryWriter::writeItem()
PoMemoryWriter::writeItems in core/lib/Drupal/Component/Gettext/PoMemoryWriter.php
Writes all or the given amount of items.

File

core/lib/Drupal/Component/Gettext/PoMemoryWriter.php, line 27

Class

PoMemoryWriter
Defines a Gettext PO memory writer, to be used by the installer.

Namespace

Drupal\Component\Gettext

Code

public function writeItem(PoItem $item) {
  if (is_array($item
    ->getSource())) {
    $item
      ->setSource(implode(PoItem::DELIMITER, $item
      ->getSource()));
    $item
      ->setTranslation(implode(PoItem::DELIMITER, $item
      ->getTranslation()));
  }
  $context = $item
    ->getContext();
  $this->items[$context != NULL ? $context : ''][$item
    ->getSource()] = $item
    ->getTranslation();
}