You are here

public function PoItem::setFromArray in Localization update 7.2

Create the PoItem from a structured array.

Parameters

array $values: Keyed array with translation data.

File

includes/gettext/PoItem.php, line 206
Definition of Drupal\Component\Gettext\PoItem.

Class

PoItem
PoItem handles one translation.

Code

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) && count($this->_source) > 1) {
    $this
      ->setPlural(count($this->_translation) > 1);
  }
}