/**
  * Implements Drupal\Component\Gettext\PoWriterInterface::writeItem().
  */
 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();
 }
 /**
  * Implements Drupal\Component\Gettext\PoWriterInterface::writeItem().
  */
 public function writeItem(PoItem $item)
 {
     if ($item->isPlural()) {
         $item->setSource(implode(LOCALE_PLURAL_DELIMITER, $item->getSource()));
         $item->setTranslation(implode(LOCALE_PLURAL_DELIMITER, $item->getTranslation()));
     }
     $this->importString($item);
 }
 /**
  * Store the parsed values as a PoItem object.
  */
 public function setItemFromArray($value)
 {
     $plural = FALSE;
     $comments = '';
     if (isset($value['#'])) {
         $comments = $this->shortenComments($value['#']);
     }
     if (is_array($value['msgstr'])) {
         // Sort plural variants by their form index.
         ksort($value['msgstr']);
         $plural = TRUE;
     }
     $item = new PoItem();
     $item->setContext(isset($value['msgctxt']) ? $value['msgctxt'] : '');
     $item->setSource($value['msgid']);
     $item->setTranslation($value['msgstr']);
     $item->setPlural($plural);
     $item->setComment($comments);
     $item->setLangcode($this->_langcode);
     $this->_last_item = $item;
     $this->_context = 'COMMENT';
 }