class PoHeader

Gettext PO header handler.

Possible Gettext PO header elements are explained in http://www.gnu.org/software/gettext/manual/gettext.html#Header-Entry, but we only support a subset of these directly.

Example header:

"Project-Id-Version: Drupal core (7.11)\n" "POT-Creation-Date: 2012-02-12 22:59+0000\n" "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n" "Language-Team: Catalan\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n>1);\n"

Hierarchy

  • class \Drupal\Component\Gettext\PoHeader

File

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

Namespace

Drupal\Component\Gettext

Members

Name Modifiers Type Description
PoHeader::$_authors private property Author(s) of the file.
PoHeader::$_langcode private property Language code.
PoHeader::$_languageName private property Human readable language name.
PoHeader::$_pluralForms private property Formula for the plural form.
PoHeader::$_po_date private property Date the po file got created.
PoHeader::$_projectName private property Name of the project the translation belongs to.
PoHeader::evaluatePlural protected function Evaluate the plural element stack using a plural value.
PoHeader::getLanguageName function Gets the human readable language name.
PoHeader::getPluralForms function Gets the plural form.
PoHeader::getProjectName function Gets the project name.
PoHeader::parseArithmetic private function Parses and sanitizes an arithmetic formula into a plural element stack.
PoHeader::parseHeader private function Parses a Gettext Portable Object file header.
PoHeader::parsePluralForms function Parses a Plural-Forms entry from a Gettext Portable Object file header.
PoHeader::setFromString public function Populate internal values from a string.
PoHeader::setLanguageName function Set the human readable language name.
PoHeader::setProjectName function Set the project name.
PoHeader::tokenizeFormula private function Tokenize the formula.
PoHeader::__construct public function Constructor, creates a PoHeader with default values.
PoHeader::__toString public function Generate a Gettext PO formatted header string based on data set earlier.

© 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!PoHeader.php/class/PoHeader/8.1.x