function TranslationManagerWrapper::doTranslate
File
-
webprofiler/
src/ StringTranslation/ TranslationManagerWrapper.php, line 37
Class
- TranslationManagerWrapper
- Class TranslationManagerWrapper
Namespace
Drupal\webprofiler\StringTranslationCode
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;
}