PoItem::setFromArray

public PoItem::setFromArray(array $values = array())

Create the PoItem from a structured array.

Parameters

array $values:

File

core/lib/Drupal/Component/Gettext/PoItem.php, line 174

Class

PoItem
PoItem handles one translation.

Namespace

Drupal\Component\Gettext

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public function setFromArray(array $values = array()) {
  if (isset($values['context'])) {
    $this->setContext($values['context']);
  }
  if (isset($values['source'])) {
    $this->setSource($values['source']);
  }
  if (isset($values['translation'])) {
    $this->setTranslation($values['translation']);
  }
  if (isset($values['comment'])) {
    $this->setComment($values['comment']);
  }
  if (isset($this->_source) &&
    strpos($this->_source, LOCALE_PLURAL_DELIMITER) !== FALSE) {
    $this->setSource(explode(LOCALE_PLURAL_DELIMITER, $this->_source));
    $this->setTranslation(explode(LOCALE_PLURAL_DELIMITER, $this->_translation));
    $this->setPlural(count($this->_source) > 1);
  }
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.