Skip to content

Commit 30da280

Browse files
committed
Merge branch '3.4'
* 3.4: A DI tag for resettable services. Add default templates directory and option to configure it Feature #23583 Add current and fallback locales in WDT / Profiler
2 parents 6980144 + f0960c5 commit 30da280

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)