Skip to content

Commit 4bf804f

Browse files
committed
Update translation commands to work with default paths
1 parent 34c2376 commit 4bf804f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

DependencyInjection/TranslatorPass.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ class TranslatorPass implements CompilerPassInterface
2121
private $translatorServiceId;
2222
private $readerServiceId;
2323
private $loaderTag;
24+
private $debugCommandServiceId;
25+
private $updateCommandServiceId;
2426

25-
public function __construct($translatorServiceId = 'translator.default', $readerServiceId = 'translation.loader', $loaderTag = 'translation.loader')
27+
public function __construct($translatorServiceId = 'translator.default', $readerServiceId = 'translation.loader', $loaderTag = 'translation.loader', $debugCommandServiceId = 'console.command.translation_debug', $updateCommandServiceId = 'console.command.translation_update')
2628
{
2729
if ('translation.loader' === $readerServiceId && 2 > func_num_args()) {
2830
@trigger_error('The default value for $readerServiceId will change in 4.0 to "translation.reader".', E_USER_DEPRECATED);
@@ -31,6 +33,8 @@ public function __construct($translatorServiceId = 'translator.default', $reader
3133
$this->translatorServiceId = $translatorServiceId;
3234
$this->readerServiceId = $readerServiceId;
3335
$this->loaderTag = $loaderTag;
36+
$this->debugCommandServiceId = $debugCommandServiceId;
37+
$this->updateCommandServiceId = $updateCommandServiceId;
3438
}
3539

3640
public function process(ContainerBuilder $container)
@@ -75,5 +79,10 @@ public function process(ContainerBuilder $container)
7579
->replaceArgument(0, ServiceLocatorTagPass::register($container, $loaderRefs))
7680
->replaceArgument(3, $loaders)
7781
;
82+
83+
if ($container->hasParameter('twig.default_path')) {
84+
$container->getDefinition($this->debugCommandServiceId)->replaceArgument(4, $container->getParameter('twig.default_path'));
85+
$container->getDefinition($this->updateCommandServiceId)->replaceArgument(5, $container->getParameter('twig.default_path'));
86+
}
7887
}
7988
}

0 commit comments

Comments
 (0)