Skip to content

Commit f3b193d

Browse files
committed
bug #15038 [Translation][debug cmd] taken account into bundle overrides path. (aitboudad)
This PR was merged into the 2.6 branch. Discussion ---------- [Translation][debug cmd] taken account into bundle overrides path. | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Fixed tickets | #14942 (partially) | Tests pass? | yes | License | MIT Commits ------- c3a077a [Translation][debug cmd] taken account into bundle overrides path.
2 parents 0727ea7 + ee6d596 commit f3b193d

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

Command/TranslationDebugCommand.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,31 @@ protected function execute(InputInterface $input, OutputInterface $output)
8383
{
8484
$locale = $input->getArgument('locale');
8585
$domain = $input->getOption('domain');
86-
$bundle = $this->getContainer()->get('kernel')->getBundle($input->getArgument('bundle'));
86+
$kernel = $this->getContainer()->get('kernel');
87+
$bundle = $kernel->getBundle($input->getArgument('bundle'));
8788
$loader = $this->getContainer()->get('translation.loader');
8889

8990
// Extract used messages
9091
$extractedCatalogue = new MessageCatalogue($locale);
91-
$this->getContainer()->get('translation.extractor')->extract($bundle->getPath().'/Resources/views', $extractedCatalogue);
92+
$bundlePaths = array(
93+
$bundle->getPath().'/Resources/',
94+
sprintf('%s/Resources/%s/', $kernel->getRootDir(), $bundle->getName()),
95+
);
96+
97+
foreach ($bundlePaths as $path) {
98+
$path = $path.'views';
99+
if (is_dir($path)) {
100+
$this->getContainer()->get('translation.extractor')->extract($path, $extractedCatalogue);
101+
}
102+
}
92103

93104
// Load defined messages
94105
$currentCatalogue = new MessageCatalogue($locale);
95-
if (is_dir($bundle->getPath().'/Resources/translations')) {
96-
$loader->loadMessages($bundle->getPath().'/Resources/translations', $currentCatalogue);
106+
foreach ($bundlePaths as $path) {
107+
$path = $path.'translations';
108+
if (is_dir($path)) {
109+
$loader->loadMessages($path, $currentCatalogue);
110+
}
97111
}
98112

99113
// Merge defined and extracted messages to get all message ids

0 commit comments

Comments
 (0)