class TranslationManagerWrapper in Devel 8
Same name and namespace in other branches
- 8.3 webprofiler/src/StringTranslation/TranslationManagerWrapper.php \Drupal\webprofiler\StringTranslation\TranslationManagerWrapper
- 8.2 webprofiler/src/StringTranslation/TranslationManagerWrapper.php \Drupal\webprofiler\StringTranslation\TranslationManagerWrapper
- 4.x webprofiler/src/StringTranslation/TranslationManagerWrapper.php \Drupal\webprofiler\StringTranslation\TranslationManagerWrapper
Class TranslationManagerWrapper
Hierarchy
- class \Drupal\Core\StringTranslation\TranslationManager implements TranslationInterface, TranslatorInterface
- class \Drupal\webprofiler\StringTranslation\TranslationManagerWrapper
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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TranslationManager:: |
protected | property | The default langcode used in translations. | |
TranslationManager:: |
protected | property | An array of translators, sorted by priority. | |
TranslationManager:: |
protected | property | An unsorted array of arrays of active translators. | |
TranslationManager:: |
public | function | Appends a translation system to the translation chain. | |
TranslationManager:: |
public | function |
Formats a string containing a count of items. Overrides TranslationInterface:: |
|
TranslationManager:: |
public | function |
Retrieves English string to given language. Overrides TranslatorInterface:: |
|
TranslationManager:: |
public | function |
Resets translation cache. Overrides TranslatorInterface:: |
|
TranslationManager:: |
public | function | Sets the default langcode. | |
TranslationManager:: |
protected | function | Sorts translators according to priority. | |
TranslationManager:: |
public | function |
Translates a string to the current language or to a given language. Overrides TranslationInterface:: |
|
TranslationManager:: |
public | function |
Translates a TranslatableMarkup object to a string. Overrides TranslationInterface:: |
|
TranslationManager:: |
public | function | Constructs a TranslationManager object. | 1 |
TranslationManagerWrapper:: |
private | property | ||
TranslationManagerWrapper:: |
private | property | ||
TranslationManagerWrapper:: |
private | property | ||
TranslationManagerWrapper:: |
protected | function |
Translates a string to the current language or to a given language. Overrides TranslationManager:: |
|
TranslationManagerWrapper:: |
public | function | ||
TranslationManagerWrapper:: |
public | function | ||
TranslationManagerWrapper:: |
public | function |