Do not log or call the proxy function when the locale is the same

This commit is contained in:
Mponos George 2019-06-12 17:14:20 +03:00 committed by Fabien Potencier
parent 41ff9d31d4
commit 31bdfb372c

View File

@ -84,6 +84,10 @@ class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterfac
{
$prev = $this->translator->getLocale();
$this->translator->setLocale($locale);
if ($prev === $locale) {
return;
}
$this->logger->debug(sprintf('The locale of the translator has changed from "%s" to "%s".', $prev, $locale));
}