private function PoItem::formatItem

private PoItem::formatItem()

Format the POItem as a string.

File

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

Class

PoItem
PoItem handles one translation.

Namespace

Drupal\Component\Gettext

Code

private function formatItem() {
  $output = '';

  // Format string context.
  if (!empty($this->_context)) {
    $output .= 'msgctxt ' . $this->formatString($this->_context);
  }

  // Format translation.
  if ($this->_plural) {
    $output .= $this->formatPlural();
  }
  else {
    $output .= $this->formatSingular();
  }

  // Add one empty line to separate the translations.
  $output .= "\n";

  return $output;
}

© 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!PoItem.php/function/PoItem::formatItem/8.1.x