diff --git a/core/lib/Drupal/Component/Gettext/PoStreamReader.php b/core/lib/Drupal/Component/Gettext/PoStreamReader.php index e3ac4b8..61c6083 100644 --- a/core/lib/Drupal/Component/Gettext/PoStreamReader.php +++ b/core/lib/Drupal/Component/Gettext/PoStreamReader.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\Component\Gettext\PoStreamReader. + * Contains \Drupal\Component\Gettext\PoStreamReader. */ namespace Drupal\Component\Gettext; @@ -10,6 +10,7 @@ use Drupal\Component\Gettext\PoReaderInterface; use Drupal\Component\Gettext\PoStreamInterface; use Drupal\Component\Gettext\PoHeader; +use Drupal\Component\Utility\String; /** * Implements Gettext PO stream reader. @@ -305,7 +306,7 @@ private function readLine() { } else { // A comment following any other context is a syntax error. - $this->_errors[] = t('The translation stream %uri contains an error: "msgstr" was expected but not found on line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains an error: "msgstr" was expected but not found on line %line.', $log_vars); return FALSE; } return; @@ -315,7 +316,7 @@ private function readLine() { if ($this->_context != 'MSGID') { // A plural form can only be added to an msgid directly. - $this->_errors[] = t('The translation stream %uri contains an error: "msgid_plural" was expected but not found on line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains an error: "msgid_plural" was expected but not found on line %line.', $log_vars); return FALSE; } @@ -326,7 +327,7 @@ private function readLine() { $quoted = $this->parseQuoted($line); if ($quoted === FALSE) { // The plural form must be wrapped in quotes. - $this->_errors[] = t('The translation stream %uri contains a syntax error on line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains a syntax error on line %line.', $log_vars); return FALSE; } @@ -353,7 +354,7 @@ private function readLine() { } elseif ($this->_context == 'MSGID') { // We are currently already in the context, meaning we passed an id with no data. - $this->_errors[] = t('The translation stream %uri contains an error: "msgid" is unexpected on line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains an error: "msgid" is unexpected on line %line.', $log_vars); return FALSE; } @@ -364,7 +365,7 @@ private function readLine() { $quoted = $this->parseQuoted($line); if ($quoted === FALSE) { // The message id must be wrapped in quotes. - $this->_errors[] = t('The translation stream %uri contains an error: invalid format for "msgid" on line %line.', $log_vars, $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains an error: invalid format for "msgid" on line %line.', $log_vars, $log_vars); return FALSE; } @@ -382,7 +383,7 @@ private function readLine() { } elseif (!empty($this->_current_item['msgctxt'])) { // A context cannot apply to another context. - $this->_errors[] = t('The translation stream %uri contains an error: "msgctxt" is unexpected on line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains an error: "msgctxt" is unexpected on line %line.', $log_vars); return FALSE; } @@ -393,7 +394,7 @@ private function readLine() { $quoted = $this->parseQuoted($line); if ($quoted === FALSE) { // The context string must be quoted. - $this->_errors[] = t('The translation stream %uri contains an error: invalid format for "msgctxt" on line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains an error: invalid format for "msgctxt" on line %line.', $log_vars); return FALSE; } @@ -411,13 +412,13 @@ private function readLine() { ($this->_context != 'MSGSTR_ARR')) { // Plural message strings must come after msgid, msgxtxt, // msgid_plural, or other msgstr[] entries. - $this->_errors[] = t('The translation stream %uri contains an error: "msgstr[]" is unexpected on line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains an error: "msgstr[]" is unexpected on line %line.', $log_vars); return FALSE; } // Ensure the plurality is terminated. if (strpos($line, ']') === FALSE) { - $this->_errors[] = t('The translation stream %uri contains an error: invalid format for "msgstr[]" on line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains an error: invalid format for "msgstr[]" on line %line.', $log_vars); return FALSE; } @@ -432,7 +433,7 @@ private function readLine() { $quoted = $this->parseQuoted($line); if ($quoted === FALSE) { // The string must be quoted. - $this->_errors[] = t('The translation stream %uri contains an error: invalid format for "msgstr[]" on line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains an error: invalid format for "msgstr[]" on line %line.', $log_vars); return FALSE; } if (!isset($this->_current_item['msgstr']) || !is_array($this->_current_item['msgstr'])) { @@ -449,7 +450,7 @@ private function readLine() { if (($this->_context != 'MSGID') && ($this->_context != 'MSGCTXT')) { // Strings are only valid within an id or context scope. - $this->_errors[] = t('The translation stream %uri contains an error: "msgstr" is unexpected on line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains an error: "msgstr" is unexpected on line %line.', $log_vars); return FALSE; } @@ -460,7 +461,7 @@ private function readLine() { $quoted = $this->parseQuoted($line); if ($quoted === FALSE) { // The string must be quoted. - $this->_errors[] = t('The translation stream %uri contains an error: invalid format for "msgstr" on line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains an error: invalid format for "msgstr" on line %line.', $log_vars); return FALSE; } @@ -475,7 +476,7 @@ private function readLine() { $quoted = $this->parseQuoted($line); if ($quoted === FALSE) { // This string must be quoted. - $this->_errors[] = t('The translation stream %uri contains an error: string continuation expected on line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains an error: string continuation expected on line %line.', $log_vars); return FALSE; } @@ -505,7 +506,7 @@ private function readLine() { } else { // No valid context to append to. - $this->_errors[] = t('The translation stream %uri contains an error: unexpected string on line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri contains an error: unexpected string on line %line.', $log_vars); return FALSE; } return; @@ -518,7 +519,7 @@ private function readLine() { $this->_current_item = array(); } elseif ($this->_context != 'COMMENT') { - $this->_errors[] = t('The translation stream %uri ended unexpectedly at line %line.', $log_vars); + $this->_errors[] = String::format('The translation stream %uri ended unexpectedly at line %line.', $log_vars); return FALSE; } }