class TranslationsDataCollector in Devel 8.2
Same name and namespace in other branches
- 8.3 webprofiler/src/DataCollector/TranslationsDataCollector.php \Drupal\webprofiler\DataCollector\TranslationsDataCollector
- 8 webprofiler/src/DataCollector/TranslationsDataCollector.php \Drupal\webprofiler\DataCollector\TranslationsDataCollector
- 4.x webprofiler/src/DataCollector/TranslationsDataCollector.php \Drupal\webprofiler\DataCollector\TranslationsDataCollector
Class TranslationsDataCollector
Hierarchy
- class \Drupal\webprofiler\DataCollector\TranslationsDataCollector extends \Symfony\Component\HttpKernel\DataCollector\DataCollector implements DrupalDataCollectorInterface uses StringTranslationTrait
Expanded class hierarchy of TranslationsDataCollector
File
- webprofiler/
src/ DataCollector/ TranslationsDataCollector.php, line 17
Namespace
Drupal\webprofiler\DataCollectorView source
class TranslationsDataCollector extends DataCollector implements DrupalDataCollectorInterface {
use StringTranslationTrait, DrupalDataCollectorTrait;
/**
* @var \Drupal\Core\StringTranslation\TranslationInterface
*/
private $translation;
/**
* @var \Drupal\Core\Routing\UrlGeneratorInterface
*/
private $urlGenerator;
/**
* @param \Drupal\Core\StringTranslation\TranslationInterface $translation
* @param \Drupal\Core\Routing\UrlGeneratorInterface $urlGenerator
*/
public function __construct(TranslationInterface $translation, UrlGeneratorInterface $urlGenerator) {
$this->translation = $translation;
$this->urlGenerator = $urlGenerator;
$this->data['translations']['translated'] = [];
$this->data['translations']['untranslated'] = [];
}
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = NULL) {
if ($this->translation instanceof TranslationManagerWrapper) {
/** \Drupal\webprofiler\StringTranslation\TranslationManagerWrapper $this->translation */
$this->data['translations']['translated'] = $this->translation
->getTranslated();
$this->data['translations']['untranslated'] = $this->translation
->getUntranslated();
}
$this->data['user_interface_translations_path'] = $this->urlGenerator
->generateFromRoute('locale.translate_page');
}
/**
* @return int
*/
public function getTranslatedCount() {
return count($this->data['translations']['translated']);
}
/**
* @return int
*/
public function getUntranslatedCount() {
return count($this->data['translations']['untranslated']);
}
/**
* {@inheritdoc}
*/
public function getName() {
return 'translations';
}
/**
* {@inheritdoc}
*/
public function getTitle() {
return $this
->t('Translations');
}
/**
* {@inheritdoc}
*/
public function getPanelSummary() {
return $this
->t('Translated: @translated, untranslated: @untranslated', [
'@translated' => $this
->getTranslatedCount(),
'@untranslated' => $this
->getUntranslatedCount(),
]);
}
/**
* {@inheritdoc}
*/
public function getIcon() {
return 'iVBORw0KGgoAAAANSUhEUgAAABUAAAAcCAYAAACOGPReAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAgpJREFUeNrUVrFuwjAQPUcZiAQDQ6WEbgwwMCJVqhjgBxhYGSvEDzBkZYSBH+ADoFJHlg4MdIMKxiLBXKAbUmEm9bPiyAREEgRDTzqZ2Mfzu7tnJ8xxHLq1aXQHuwsos2078p9arVYg0yL3CXcnwCdubKDp3F+5myFin9xYK0xNzQiZm1c3KpVKUb1ep2QyebvuFwoFSqfTlM/nbweay+VoOBxeDar7JwC03W49UO5fs9nsZTwef8qYUqkUjSmAYrGYqKlhGFSpVH45oBFFdkdM0RjUst1uC7Z45ofjWdO0t8Ph8CDjyuUyZTIZ6na7tNvtTmSn+2s5n88FIMwdPzhgUWYBA2A2mxVjIpEQarEsiwaDAS2XSxPH9OI1xVNnbmo0Go28eTDkAOL3YrGg/X4v1tfr9WmjLplsULVaFawbjYbHkjfzqPsr7o9RwJE2HOkifbAGS1ljdL/G/ScsWK/XE+NmsxGMkW6/3xfgWMMIpu9hLgkEN5tNDwClgAoADjAYRszr8m7kD2gGU5uh1hEjmoGUUU/oGLVEXaVhA2yoKYAwRwFx/Ezj8bjHEIYaSgVgDptNp1NiePG5QCfS4qyZXANop9MR7JANWAFA6hWgWEcmqqTYOWBVl0jZf0ViU+hUNk0AyVf0ObYK0+8IslupF8qlkxVWdoipsaCPiaBr7uwr+t98ofwJMADuIP9IDjFbLwAAAABJRU5ErkJggg==';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrupalDataCollectorInterface:: |
public | function | 8 | |
DrupalDataCollectorInterface:: |
public | function | 1 | |
DrupalDataCollectorInterface:: |
public | function | Returns the libraries needed in detail panel. | 2 |
DrupalDataCollectorInterface:: |
public | function | Returns true if this datacollector has a detail panel. | 2 |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
TranslationsDataCollector:: |
private | property | ||
TranslationsDataCollector:: |
private | property | ||
TranslationsDataCollector:: |
public | function | Collects data for the given Request and Response. | |
TranslationsDataCollector:: |
public | function |
Returns the collector icon in base64 format. Overrides DrupalDataCollectorInterface:: |
|
TranslationsDataCollector:: |
public | function |
Returns the name of the collector. Overrides DrupalDataCollectorInterface:: |
|
TranslationsDataCollector:: |
public | function |
Returns the string used in vertical tab summary. Overrides DrupalDataCollectorInterface:: |
|
TranslationsDataCollector:: |
public | function |
Returns the datacollector title. Overrides DrupalDataCollectorInterface:: |
|
TranslationsDataCollector:: |
public | function | ||
TranslationsDataCollector:: |
public | function | ||
TranslationsDataCollector:: |
public | function |