Skip to content

Commit f0960c5

Browse files
committed
feature #23625 Feature #23583 Add current and fallback locales in WDT / Profiler (nemoneph)
This PR was merged into the 3.4 branch. Discussion ---------- Feature #23583 Add current and fallback locales in WDT / Profiler | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #23583 | License | MIT | Doc PR | - The goal of this PR is to add informations about the locale and the fallback locales in the translation WDT panel / and profiler Commits ------- 98a8a6c735 Feature #23583 Add current and fallback locales in WDT / Profiler
2 parents eb3635f + b82cf4f commit f0960c5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

DataCollector/TranslationDataCollector.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public function lateCollect()
4545
$this->data = $this->computeCount($messages);
4646
$this->data['messages'] = $messages;
4747

48+
$this->data['locale'] = $this->translator->getLocale();
49+
$this->data['fallback_locales'] = $this->translator->getFallbackLocales();
50+
4851
$this->data = $this->cloneVar($this->data);
4952
}
5053

@@ -87,6 +90,16 @@ public function getCountDefines()
8790
return isset($this->data[DataCollectorTranslator::MESSAGE_DEFINED]) ? $this->data[DataCollectorTranslator::MESSAGE_DEFINED] : 0;
8891
}
8992

93+
public function getLocale()
94+
{
95+
return !empty($this->data['locale']) ? $this->data['locale'] : null;
96+
}
97+
98+
public function getFallbackLocales()
99+
{
100+
return (isset($this->data['fallback_locales']) && count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : array();
101+
}
102+
90103
/**
91104
* {@inheritdoc}
92105
*/

0 commit comments

Comments
 (0)