function PoHeader::__toString
Same name in other branches
- 9 core/lib/Drupal/Component/Gettext/PoHeader.php \Drupal\Component\Gettext\PoHeader::__toString()
- 8.9.x core/lib/Drupal/Component/Gettext/PoHeader.php \Drupal\Component\Gettext\PoHeader::__toString()
- 11.x core/lib/Drupal/Component/Gettext/PoHeader.php \Drupal\Component\Gettext\PoHeader::__toString()
Generate a Gettext PO formatted header string based on data set earlier.
File
-
core/
lib/ Drupal/ Component/ Gettext/ PoHeader.php, line 152
Class
- PoHeader
- Gettext PO header handler.
Namespace
Drupal\Component\GettextCode
public function __toString() {
$output = '';
$isTemplate = empty($this->languageName);
$output .= '# ' . ($isTemplate ? 'LANGUAGE' : $this->languageName) . ' translation of ' . ($isTemplate ? 'PROJECT' : $this->projectName) . "\n";
if (!empty($this->authors)) {
$output .= '# Generated by ' . implode("\n# ", $this->authors) . "\n";
}
$output .= "#\n";
// Add the actual header information.
$output .= "msgid \"\"\n";
$output .= "msgstr \"\"\n";
$output .= "\"Project-Id-Version: PROJECT VERSION\\n\"\n";
$output .= "\"POT-Creation-Date: " . $this->poDate . "\\n\"\n";
$output .= "\"PO-Revision-Date: " . $this->poDate . "\\n\"\n";
$output .= "\"Last-Translator: NAME <EMAIL@ADDRESS>\\n\"\n";
$output .= "\"Language-Team: LANGUAGE <EMAIL@ADDRESS>\\n\"\n";
$output .= "\"MIME-Version: 1.0\\n\"\n";
$output .= "\"Content-Type: text/plain; charset=utf-8\\n\"\n";
$output .= "\"Content-Transfer-Encoding: 8bit\\n\"\n";
$output .= "\"Plural-Forms: " . $this->pluralForms . "\\n\"\n";
$output .= "\n";
return $output;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.