[Translation][debug cmd] taken account into bundle overrides path.

This commit is contained in:
Abdellatif Ait boudad 2015-06-19 15:20:37 +00:00
parent 287db73898
commit c3a077a38b

View File

@ -83,17 +83,31 @@ EOF
{
$locale = $input->getArgument('locale');
$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');
// Extract used messages
$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
$currentCatalogue = new MessageCatalogue($locale);
if (is_dir($bundle->getPath().'/Resources/translations')) {
$loader->loadMessages($bundle->getPath().'/Resources/translations', $currentCatalogue);
foreach ($bundlePaths as $path) {
$path = $path.'translations';
if (is_dir($path)) {
$loader->loadMessages($path, $currentCatalogue);
}
}
// Merge defined and extracted messages to get all message ids