diff --git a/src/Translator/doc/index.rst b/src/Translator/doc/index.rst index 0b36da695ac..9bfd9e32583 100644 --- a/src/Translator/doc/index.rst +++ b/src/Translator/doc/index.rst @@ -71,10 +71,6 @@ For a better developer experience, TypeScript types definitions are also generat Then, you will be able to import those JavaScript translations in your assets. Don't worry about your final bundle size, only the translations you use will be included in your final bundle, thanks to the `tree shaking `_. -.. note:: - - This package requires the `translator` to be enabled in your Symfony application. If you don't use the `translator` service, the warmup command will not generate any translations. - Configuring the dumped translations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/Translator/src/DependencyInjection/TranslatorCompilerPass.php b/src/Translator/src/DependencyInjection/TranslatorCompilerPass.php deleted file mode 100644 index 1b69209aa00..00000000000 --- a/src/Translator/src/DependencyInjection/TranslatorCompilerPass.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\UX\Translator\DependencyInjection; - -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\Translation\TranslatorBagInterface; - -class TranslatorCompilerPass implements CompilerPassInterface -{ - public function process(ContainerBuilder $container): void - { - if (!$this->hasValidTranslator($container)) { - $container->removeDefinition('ux.translator.cache_warmer.translations_cache_warmer'); - } - } - - private function hasValidTranslator(ContainerBuilder $containerBuilder): bool - { - if (!$containerBuilder->hasDefinition('translator')) { - return false; - } - - $translator = $containerBuilder->getDefinition('translator'); - if (!is_subclass_of($translator->getClass(), TranslatorBagInterface::class)) { - return false; - } - - return true; - } -} diff --git a/src/Translator/src/UxTranslatorBundle.php b/src/Translator/src/UxTranslatorBundle.php index ff6c74928aa..d815a6c9ee7 100644 --- a/src/Translator/src/UxTranslatorBundle.php +++ b/src/Translator/src/UxTranslatorBundle.php @@ -13,7 +13,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; -use Symfony\UX\Translator\DependencyInjection\TranslatorCompilerPass; /** * @author Hugo Alliaume @@ -28,9 +27,4 @@ public function getPath(): string { return \dirname(__DIR__); } - - public function build(ContainerBuilder $container): void - { - $container->addCompilerPass(new TranslatorCompilerPass()); - } } diff --git a/src/Translator/tests/Kernel/FrameworkAppKernel.php b/src/Translator/tests/Kernel/FrameworkAppKernel.php index 2686ab7e54d..98c0ca6a703 100644 --- a/src/Translator/tests/Kernel/FrameworkAppKernel.php +++ b/src/Translator/tests/Kernel/FrameworkAppKernel.php @@ -38,10 +38,6 @@ public function registerContainerConfiguration(LoaderInterface $loader) 'secret' => '$ecret', 'test' => true, 'translator' => [ - 'enabled' => match ($this->environment) { - 'test_without_translator' => false, - default => true, - }, 'fallbacks' => ['en'], ], 'http_method_override' => false, diff --git a/src/Translator/tests/UxTranslatorBundleTest.php b/src/Translator/tests/UxTranslatorBundleTest.php index fe17709d8b0..8f244289558 100644 --- a/src/Translator/tests/UxTranslatorBundleTest.php +++ b/src/Translator/tests/UxTranslatorBundleTest.php @@ -22,7 +22,6 @@ public static function provideKernels() { yield 'empty' => [new EmptyAppKernel('test', true)]; yield 'framework' => [new FrameworkAppKernel('test', true)]; - yield 'framework without translator' => [new FrameworkAppKernel('test_without_translator', true)]; } /**