You are here

private function PoItem::formatItem in Service Container 7

Same name and namespace in other branches
  1. 7.2 lib/Drupal/Component/Gettext/PoItem.php \Drupal\Component\Gettext\PoItem::formatItem()

Format the POItem as a string.

1 call to PoItem::formatItem()
PoItem::__toString in lib/Drupal/Component/Gettext/PoItem.php
Output the PoItem as a string.

File

lib/Drupal/Component/Gettext/PoItem.php, line 210
Contains \Drupal\Component\Gettext\PoItem.

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;
}