for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* File containing the TranslationPass class.
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler;
use eZ\Bundle\EzPublishCoreBundle\Translation\Collector;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
* This compilation pass loads every ezplatform available translations into symfony translator
class TranslationPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
if (!$container->hasDefinition('translator.default')) {
return;
}
$definition = $container->getDefinition('translator.default');
$collector = new Collector($container->getParameterBag()->get('kernel.root_dir'));
foreach ($collector->collect() as $file) {
$definition->addMethodCall(
'addResource',
array($file['format'], $file['file'], $file['locale'], $file['domain'])
);