class TranslationManagerWrapper
Class TranslationManagerWrapper
Hierarchy
- class \Drupal\webprofiler\StringTranslation\TranslationManagerWrapper extends \Drupal\Core\StringTranslation\TranslationManager
Expanded class hierarchy of TranslationManagerWrapper
1 file declares its use of TranslationManagerWrapper
- TranslationsDataCollector.php in webprofiler/
src/ DataCollector/ TranslationsDataCollector.php
File
-
webprofiler/
src/ StringTranslation/ TranslationManagerWrapper.php, line 10
Namespace
Drupal\webprofiler\StringTranslationView source
class TranslationManagerWrapper extends TranslationManager {
/**
* @var \Drupal\webprofiler\StringTranslation\TranslationManagerWrapper
*/
private $translationManager;
/**
* @var array
*/
private $translated;
/**
* @var array
*/
private $untranslated;
/**
* @param \Drupal\webprofiler\StringTranslation\TranslationManagerWrapper $translationManager
*/
public function setDataCollector(TranslationManagerWrapper $translationManager) {
$this->translationManager = $translationManager;
}
/**
* {@inheritdoc}
*/
protected function doTranslate($string, array $options = array()) {
// Merge in defaults.
if (empty($options['langcode'])) {
$options['langcode'] = $this->defaultLangcode;
}
if (empty($options['context'])) {
$options['context'] = '';
}
$translation = $this->getStringTranslation($options['langcode'], $string, $options['context']);
if ($translation) {
$this->translated[$string] = $translation;
}
else {
$this->untranslated[$string] = $string;
}
return $translation === FALSE ? $string : $translation;
}
/**
* @return array
*/
public function getTranslated() {
return $this->translated;
}
/**
* @return array
*/
public function getUntranslated() {
return $this->untranslated;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
TranslationManagerWrapper::$translated | private | property | |
TranslationManagerWrapper::$translationManager | private | property | |
TranslationManagerWrapper::$untranslated | private | property | |
TranslationManagerWrapper::doTranslate | protected | function | |
TranslationManagerWrapper::getTranslated | public | function | |
TranslationManagerWrapper::getUntranslated | public | function | |
TranslationManagerWrapper::setDataCollector | public | function |