From 70c282447baff59528469f09da87d9411f894576 Mon Sep 17 00:00:00 2001 From: Jeroen van den Enden Date: Tue, 28 May 2019 16:30:11 +0200 Subject: [PATCH] Add Symfony 4.3 kernel.locale_aware tag Symfony 4.3 does not use the TranslatorListener anymore to set the locale. Instead, the LocaleAwareListener is used to collect locale aware services and set the locale on them. This tag makes sure the Lexik translator is marked as a locale aware service so the locale is set correctly in Symfony >= 4.3 without breaking compatibility with earlier versions. --- DependencyInjection/LexikTranslationExtension.php | 1 + 1 file changed, 1 insertion(+) diff --git a/DependencyInjection/LexikTranslationExtension.php b/DependencyInjection/LexikTranslationExtension.php index c714d9af..71398503 100644 --- a/DependencyInjection/LexikTranslationExtension.php +++ b/DependencyInjection/LexikTranslationExtension.php @@ -105,6 +105,7 @@ public function buildTranslatorDefinition(ContainerBuilder $container) $translator->setArguments($arguments); $translator->addMethodCall('setConfigCacheFactory', [new Reference('config_cache_factory')]); + $translator->addTag('kernel.locale_aware'); $container->setDefinition('lexik_translation.translator', $translator); }