You are here

private function PoItem::formatPlural in Service Container 7

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

Formats a plural translation.

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

File

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

Class

PoItem
PoItem handles one translation.

Namespace

Drupal\Component\Gettext

Code

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

  // Format source strings.
  $output .= 'msgid ' . $this
    ->formatString($this->_source[0]);
  $output .= 'msgid_plural ' . $this
    ->formatString($this->_source[1]);
  foreach ($this->_translation as $i => $trans) {
    if (isset($this->_translation[$i])) {
      $output .= 'msgstr[' . $i . '] ' . $this
        ->formatString($trans);
    }
    else {
      $output .= 'msgstr[' . $i . '] ""' . "\n";
    }
  }
  return $output;
}