You are here

public function PoMemoryWriter::writeItem in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 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();
}