/** * Implements PoWriterInterface::writeItem(). */ public function writeItem(PoItem $item) { if (is_array($item->getSource())) { $item->setSource(implode(L10N_UPDATE_PLURAL_DELIMITER, $item->getSource())); $item->setTranslation(implode(L10N_UPDATE_PLURAL_DELIMITER, $item->getTranslation())); } $context = $item->getContext(); $this->_items[$context != NULL ? $context : ''][$item->getSource()] = $item->getTranslation(); }
/** * Store the parsed values as a PoItem object. */ public function setItemFromArray($value) { $plural = FALSE; $comments = ''; $textgroup = 'default'; if (isset($value['#'])) { $comments = $this->shortenComments($value['#']); $textgroup = $this->fetchGroupFromComment($comments); } 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); $item->setTextgroup($textgroup); $this->_last_item = $item; $this->_context = 'COMMENT'; }
/** * Implements PoWriterInterface::writeItem(). */ function writeItem(PoItem $item) { if ($item->isPlural()) { $item->setSource(join(L10N_UPDATE_PLURAL_DELIMITER, $item->getSource())); $item->setTranslation(join(L10N_UPDATE_PLURAL_DELIMITER, $item->getTranslation())); } $this->importString($item); }