*
* @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.
* @return string with langcode
*/
public function getLangcode() {
- return $this->_langcode;
+ return $this->langcode;
}
/**
* @param string $langcode
*/
public function setLangcode($langcode) {
- $this->_langcode = $langcode;
+ $this->langcode = $langcode;
}
/**
* @return string $context
*/
public function getContext() {
- return $this->_context;
+ return $this->context;
}
/**
* @param string $context
*/
public function setContext($context) {
- $this->_context = $context;
+ $this->context = $context;
}
/**
* @return string or array $translation
*/
public function getSource() {
- return $this->_source;
+ return $this->source;
}
/**
* @param string|array $source
*/
public function setSource($source) {
- $this->_source = $source;
+ $this->source = $source;
}
/**
* @return string or array $translation
*/
public function getTranslation() {
- return $this->_translation;
+ return $this->translation;
}
/**
* @param string|array $translation
*/
public function setTranslation($translation) {
- $this->_translation = $translation;
+ $this->translation = $translation;
}
/**
* @param bool $plural
*/
public function setPlural($plural) {
- $this->_plural = $plural;
+ $this->plural = $plural;
}
/**
* @return bool
*/
public function isPlural() {
- return $this->_plural;
+ return $this->plural;
}
/**
* @return String $comment
*/
public function getComment() {
- return $this->_comment;
+ return $this->comment;
}
/**
* @param string $comment
*/
public function setComment($comment) {
- $this->_comment = $comment;
+ $this->comment = $comment;
}
/**
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);
}
}
$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 {
$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 {
*/
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;
}