You are here

public function PoMemoryWriter::writeItem in Service Container 7.2

Same name and namespace in other branches
  1. 7 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 lib/Drupal/Component/Gettext/PoMemoryWriter.php
Writes all or the given amount of items.

File

lib/Drupal/Component/Gettext/PoMemoryWriter.php, line 32
Contains \Drupal\Component\Gettext\PoMemoryWriter.

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(LOCALE_PLURAL_DELIMITER, $item
      ->getSource()));
    $item
      ->setTranslation(implode(LOCALE_PLURAL_DELIMITER, $item
      ->getTranslation()));
  }
  $context = $item
    ->getContext();
  $this->_items[$context != NULL ? $context : ''][$item
    ->getSource()] = $item
    ->getTranslation();
}