diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php index f5cc1fb805489..ffe5074dff47f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php @@ -44,7 +44,7 @@ protected function configure() )) ->setDefinition(array( new InputArgument('locale', InputArgument::REQUIRED, 'The locale'), - new InputArgument('bundle', InputArgument::REQUIRED, 'The bundle name'), + new InputArgument('bundle', InputArgument::OPTIONAL, 'The bundle name'), new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'The messages domain'), new InputOption('only-missing', null, InputOption::VALUE_NONE, 'Displays only missing messages'), new InputOption('only-unused', null, InputOption::VALUE_NONE, 'Displays only unused messages'), @@ -54,6 +54,7 @@ protected function configure() The %command.name% command helps finding unused or missing translation messages and comparing them with the fallback ones by inspecting the templates and translation files of a given bundle. +If option missed the command will display information about translations that located in %%kernel.root_dir%%. You can display information about bundle translations in a specific locale: @@ -87,17 +88,17 @@ protected function execute(InputInterface $input, OutputInterface $output) $locale = $input->getArgument('locale'); $domain = $input->getOption('domain'); - $bundle = $this->getContainer()->get('kernel')->getBundle($input->getArgument('bundle')); + $bundlePath = $input->hasOption('bundle') ? $this->getContainer()->get('kernel')->getBundle($input->getArgument('bundle')) : $this->getContainer()->getParameter('kernel.root_dir'); $loader = $this->getContainer()->get('translation.loader'); // Extract used messages $extractedCatalogue = new MessageCatalogue($locale); - $this->getContainer()->get('translation.extractor')->extract($bundle->getPath().'/Resources/views', $extractedCatalogue); + $this->getContainer()->get('translation.extractor')->extract($bundlePath.'/Resources/views', $extractedCatalogue); // Load defined messages $currentCatalogue = new MessageCatalogue($locale); - if (is_dir($bundle->getPath().'/Resources/translations')) { - $loader->loadMessages($bundle->getPath().'/Resources/translations', $currentCatalogue); + if (is_dir($bundlePath.'/Resources/translations')) { + $loader->loadMessages($bundlePath.'/Resources/translations', $currentCatalogue); } // Merge defined and extracted messages to get all message ids @@ -130,7 +131,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } $fallbackCatalogue = new MessageCatalogue($fallbackLocale); - $loader->loadMessages($bundle->getPath().'/Resources/translations', $fallbackCatalogue); + $loader->loadMessages($bundlePath.'/Resources/translations', $fallbackCatalogue); $fallbackCatalogues[] = $fallbackCatalogue; } }