TranslatorPass.php 683 B

12345678910111213141516171819202122
  1. <?php
  2. namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
  3. use Symfony\Component\DependencyInjection\ContainerBuilder;
  4. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  5. class TranslatorPass implements CompilerPassInterface
  6. {
  7. public function process(ContainerBuilder $container)
  8. {
  9. if (!$container->hasDefinition('translator')) {
  10. return;
  11. }
  12. $loaders = array();
  13. foreach ($container->findTaggedServiceIds('translation.loader') as $id => $attributes) {
  14. $loaders[$id] = $attributes[0]['alias'];
  15. }
  16. $container->setParameter('translation.loaders', $loaders);
  17. }
  18. }