function PoHeader::setFromString

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Component/Gettext/PoHeader.php \Drupal\Component\Gettext\PoHeader::setFromString()
  2. 8.9.x core/lib/Drupal/Component/Gettext/PoHeader.php \Drupal\Component\Gettext\PoHeader::setFromString()
  3. 10 core/lib/Drupal/Component/Gettext/PoHeader.php \Drupal\Component\Gettext\PoHeader::setFromString()

Populate internal values from a string.

Parameters

string $header: Full header string with key-value pairs.

File

core/lib/Drupal/Component/Gettext/PoHeader.php, line 138

Class

PoHeader
Gettext PO header handler.

Namespace

Drupal\Component\Gettext

Code

public function setFromString($header) {
    // Get an array of all header values for processing.
    $values = $this->parseHeader($header);
    // There is only one value relevant for our header implementation when
    // reading, and that is the plural formula.
    if (!empty($values['Plural-Forms'])) {
        $this->pluralForms = $values['Plural-Forms'];
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.