Mercurial > hg > isophonics-drupal-site
diff core/lib/Drupal/Component/Gettext/PoItem.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 7a779792577d |
children | af1871eacc83 |
line wrap: on
line diff
--- a/core/lib/Drupal/Component/Gettext/PoItem.php Tue Jul 10 15:07:59 2018 +0100 +++ b/core/lib/Drupal/Component/Gettext/PoItem.php Thu Feb 28 13:21:36 2019 +0000 @@ -15,45 +15,45 @@ * * @var string */ - private $_langcode; + protected $langcode; /** * The context this translation belongs to. * * @var string */ - private $_context = ''; + protected $context = ''; /** * The source string or array of strings if it has plurals. * * @var string|array * - * @see $_plural + * @see $plural */ - private $_source; + protected $source; /** * Flag indicating if this translation has plurals. * * @var bool */ - private $_plural; + protected $plural; /** * The comment of this translation. * * @var string */ - private $_comment; + protected $comment; /** * The translation string or array of strings if it has plurals. * * @var string|array - * @see $_plural + * @see $plural */ - private $_translation; + protected $translation; /** * Gets the language code of the currently used language. @@ -61,7 +61,7 @@ * @return string with langcode */ public function getLangcode() { - return $this->_langcode; + return $this->langcode; } /** @@ -70,7 +70,7 @@ * @param string $langcode */ public function setLangcode($langcode) { - $this->_langcode = $langcode; + $this->langcode = $langcode; } /** @@ -79,7 +79,7 @@ * @return string $context */ public function getContext() { - return $this->_context; + return $this->context; } /** @@ -88,7 +88,7 @@ * @param string $context */ public function setContext($context) { - $this->_context = $context; + $this->context = $context; } /** @@ -98,7 +98,7 @@ * @return string or array $translation */ public function getSource() { - return $this->_source; + return $this->source; } /** @@ -108,7 +108,7 @@ * @param string|array $source */ public function setSource($source) { - $this->_source = $source; + $this->source = $source; } /** @@ -118,7 +118,7 @@ * @return string or array $translation */ public function getTranslation() { - return $this->_translation; + return $this->translation; } /** @@ -128,7 +128,7 @@ * @param string|array $translation */ public function setTranslation($translation) { - $this->_translation = $translation; + $this->translation = $translation; } /** @@ -137,7 +137,7 @@ * @param bool $plural */ public function setPlural($plural) { - $this->_plural = $plural; + $this->plural = $plural; } /** @@ -146,7 +146,7 @@ * @return bool */ public function isPlural() { - return $this->_plural; + return $this->plural; } /** @@ -155,7 +155,7 @@ * @return String $comment */ public function getComment() { - return $this->_comment; + return $this->comment; } /** @@ -164,7 +164,7 @@ * @param string $comment */ public function setComment($comment) { - $this->_comment = $comment; + $this->comment = $comment; } /** @@ -185,11 +185,11 @@ if (isset($values['comment'])) { $this->setComment($values['comment']); } - if (isset($this->_source) && - strpos($this->_source, LOCALE_PLURAL_DELIMITER) !== FALSE) { - $this->setSource(explode(LOCALE_PLURAL_DELIMITER, $this->_source)); - $this->setTranslation(explode(LOCALE_PLURAL_DELIMITER, $this->_translation)); - $this->setPlural(count($this->_source) > 1); + if (isset($this->source) && + strpos($this->source, LOCALE_PLURAL_DELIMITER) !== FALSE) { + $this->setSource(explode(LOCALE_PLURAL_DELIMITER, $this->source)); + $this->setTranslation(explode(LOCALE_PLURAL_DELIMITER, $this->translation)); + $this->setPlural(count($this->source) > 1); } } @@ -207,12 +207,12 @@ $output = ''; // Format string context. - if (!empty($this->_context)) { - $output .= 'msgctxt ' . $this->formatString($this->_context); + if (!empty($this->context)) { + $output .= 'msgctxt ' . $this->formatString($this->context); } // Format translation. - if ($this->_plural) { + if ($this->plural) { $output .= $this->formatPlural(); } else { @@ -232,11 +232,11 @@ $output = ''; // Format source strings. - $output .= 'msgid ' . $this->formatString($this->_source[0]); - $output .= 'msgid_plural ' . $this->formatString($this->_source[1]); + $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])) { + foreach ($this->translation as $i => $trans) { + if (isset($this->translation[$i])) { $output .= 'msgstr[' . $i . '] ' . $this->formatString($trans); } else { @@ -252,8 +252,8 @@ */ private function formatSingular() { $output = ''; - $output .= 'msgid ' . $this->formatString($this->_source); - $output .= 'msgstr ' . (isset($this->_translation) ? $this->formatString($this->_translation) : '""'); + $output .= 'msgid ' . $this->formatString($this->source); + $output .= 'msgstr ' . (isset($this->translation) ? $this->formatString($this->translation) : '""'); return $output; }