function PoMemoryWriter::writeItem

Same name in other branches
  1. 9 core/lib/Drupal/Component/Gettext/PoMemoryWriter.php \Drupal\Component\Gettext\PoMemoryWriter::writeItem()
  2. 8.9.x core/lib/Drupal/Component/Gettext/PoMemoryWriter.php \Drupal\Component\Gettext\PoMemoryWriter::writeItem()
  3. 10 core/lib/Drupal/Component/Gettext/PoMemoryWriter.php \Drupal\Component\Gettext\PoMemoryWriter::writeItem()

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.