On this page
public function PoStreamReader::setItemFromArray
public PoStreamReader::setItemFromArray($value)
Store the parsed values as a PoItem object.
File
- core/lib/Drupal/Component/Gettext/PoStreamReader.php, line 514
Class
- PoStreamReader
- Implements Gettext PO stream reader.
Namespace
Drupal\Component\GettextCode
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';
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Gettext!PoStreamReader.php/function/PoStreamReader::setItemFromArray/8.1.x