You are here

private function PoStreamReader::shortenComments in Localization update 7.2

Generates a short, one-string version of the passed comment array.

Parameters

string|array $comment: An array of strings containing a comment.

Return value

string Short one-string version of the comment.

1 call to PoStreamReader::shortenComments()
PoStreamReader::setItemFromArray in includes/gettext/PoStreamReader.php
Store the parsed values as a PoItem object.

File

includes/gettext/PoStreamReader.php, line 589
Contains \Drupal\Component\Gettext\PoStreamReader.

Class

PoStreamReader
Implements Gettext PO stream reader.

Code

private function shortenComments($comment) {
  $comm = '';
  while (count($comment)) {
    $test = $comm . substr(array_shift($comment), 1) . ', ';
    if (strlen($comm) < 130) {
      $comm = $test;
    }
    else {
      break;
    }
  }
  return trim(substr($comm, 0, -2));
}