From 31bdfb372c408f64592f17d1c720899c852df6a1 Mon Sep 17 00:00:00 2001 From: Mponos George Date: Wed, 12 Jun 2019 17:14:20 +0300 Subject: [PATCH] Do not log or call the proxy function when the locale is the same --- src/Symfony/Component/Translation/LoggingTranslator.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Translation/LoggingTranslator.php b/src/Symfony/Component/Translation/LoggingTranslator.php index 3a84bf1170..2996167d08 100644 --- a/src/Symfony/Component/Translation/LoggingTranslator.php +++ b/src/Symfony/Component/Translation/LoggingTranslator.php @@ -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)); }