function PoStreamReader::shortenComments

Same name in other branches
  1. 9 core/lib/Drupal/Component/Gettext/PoStreamReader.php \Drupal\Component\Gettext\PoStreamReader::shortenComments()
  2. 8.9.x core/lib/Drupal/Component/Gettext/PoStreamReader.php \Drupal\Component\Gettext\PoStreamReader::shortenComments()
  3. 10 core/lib/Drupal/Component/Gettext/PoStreamReader.php \Drupal\Component\Gettext\PoStreamReader::shortenComments()

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

Parameters

string[] $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 core/lib/Drupal/Component/Gettext/PoStreamReader.php
Store the parsed values as a PoItem object.

File

core/lib/Drupal/Component/Gettext/PoStreamReader.php, line 581

Class

PoStreamReader
Implements Gettext PO stream reader.

Namespace

Drupal\Component\Gettext

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.