TranslationManagerWrapper.php in Devel 8
File
webprofiler/src/StringTranslation/TranslationManagerWrapper.php
View source
<?php
namespace Drupal\webprofiler\StringTranslation;
use Drupal\Core\StringTranslation\TranslationManager;
class TranslationManagerWrapper extends TranslationManager {
private $translationManager;
private $translated;
private $untranslated;
public function setDataCollector(TranslationManagerWrapper $translationManager) {
$this->translationManager = $translationManager;
}
protected function doTranslate($string, array $options = array()) {
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;
}
public function getTranslated() {
return $this->translated;
}
public function getUntranslated() {
return $this->untranslated;
}
}