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.
This commit is contained in:
commit
e64b9bbcbd
@ -83,17 +83,31 @@ EOF
|
|||||||
{
|
{
|
||||||
$locale = $input->getArgument('locale');
|
$locale = $input->getArgument('locale');
|
||||||
$domain = $input->getOption('domain');
|
$domain = $input->getOption('domain');
|
||||||
$bundle = $this->getContainer()->get('kernel')->getBundle($input->getArgument('bundle'));
|
$kernel = $this->getContainer()->get('kernel');
|
||||||
|
$bundle = $kernel->getBundle($input->getArgument('bundle'));
|
||||||
$loader = $this->getContainer()->get('translation.loader');
|
$loader = $this->getContainer()->get('translation.loader');
|
||||||
|
|
||||||
// Extract used messages
|
// Extract used messages
|
||||||
$extractedCatalogue = new MessageCatalogue($locale);
|
$extractedCatalogue = new MessageCatalogue($locale);
|
||||||
$this->getContainer()->get('translation.extractor')->extract($bundle->getPath().'/Resources/views', $extractedCatalogue);
|
$bundlePaths = array(
|
||||||
|
$bundle->getPath().'/Resources/',
|
||||||
|
sprintf('%s/Resources/%s/', $kernel->getRootDir(), $bundle->getName()),
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($bundlePaths as $path) {
|
||||||
|
$path = $path.'views';
|
||||||
|
if (is_dir($path)) {
|
||||||
|
$this->getContainer()->get('translation.extractor')->extract($path, $extractedCatalogue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Load defined messages
|
// Load defined messages
|
||||||
$currentCatalogue = new MessageCatalogue($locale);
|
$currentCatalogue = new MessageCatalogue($locale);
|
||||||
if (is_dir($bundle->getPath().'/Resources/translations')) {
|
foreach ($bundlePaths as $path) {
|
||||||
$loader->loadMessages($bundle->getPath().'/Resources/translations', $currentCatalogue);
|
$path = $path.'translations';
|
||||||
|
if (is_dir($path)) {
|
||||||
|
$loader->loadMessages($path, $currentCatalogue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge defined and extracted messages to get all message ids
|
// Merge defined and extracted messages to get all message ids
|
||||||
|
Reference in New Issue
Block a user