comparison core/lib/Drupal/Component/Gettext/PoMemoryWriter.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
10 /** 10 /**
11 * Array to hold all PoItem elements. 11 * Array to hold all PoItem elements.
12 * 12 *
13 * @var array 13 * @var array
14 */ 14 */
15 private $_items; 15 protected $items;
16 16
17 /** 17 /**
18 * Constructor, initialize empty items. 18 * Constructor, initialize empty items.
19 */ 19 */
20 public function __construct() { 20 public function __construct() {
21 $this->_items = []; 21 $this->items = [];
22 } 22 }
23 23
24 /** 24 /**
25 * {@inheritdoc} 25 * {@inheritdoc}
26 */ 26 */
28 if (is_array($item->getSource())) { 28 if (is_array($item->getSource())) {
29 $item->setSource(implode(LOCALE_PLURAL_DELIMITER, $item->getSource())); 29 $item->setSource(implode(LOCALE_PLURAL_DELIMITER, $item->getSource()));
30 $item->setTranslation(implode(LOCALE_PLURAL_DELIMITER, $item->getTranslation())); 30 $item->setTranslation(implode(LOCALE_PLURAL_DELIMITER, $item->getTranslation()));
31 } 31 }
32 $context = $item->getContext(); 32 $context = $item->getContext();
33 $this->_items[$context != NULL ? $context : ''][$item->getSource()] = $item->getTranslation(); 33 $this->items[$context != NULL ? $context : ''][$item->getSource()] = $item->getTranslation();
34 } 34 }
35 35
36 /** 36 /**
37 * {@inheritdoc} 37 * {@inheritdoc}
38 */ 38 */
47 * Get all stored PoItem's. 47 * Get all stored PoItem's.
48 * 48 *
49 * @return array PoItem 49 * @return array PoItem
50 */ 50 */
51 public function getData() { 51 public function getData() {
52 return $this->_items; 52 return $this->items;
53 } 53 }
54 54
55 /** 55 /**
56 * Implements Drupal\Component\Gettext\PoMetadataInterface:setLangcode(). 56 * Implements Drupal\Component\Gettext\PoMetadataInterface:setLangcode().
57 * 57 *