diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php index a9978bdec1475..16080101160d7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php @@ -207,15 +207,15 @@ protected function execute(InputInterface $input, OutputInterface $output) private function formatState($state) { if (self::MESSAGE_MISSING === $state) { - return 'missing'; + return ' missing '; } if (self::MESSAGE_UNUSED === $state) { - return 'unused'; + return ' unused '; } if (self::MESSAGE_EQUALS_FALLBACK === $state) { - return 'fallback'; + return ' fallback '; } return $state; @@ -233,7 +233,7 @@ private function formatStates(array $states) private function formatId($id) { - return sprintf('%s', $id); + return sprintf('%s', $id); } private function sanitizeString($string, $length = 40) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php index 57634b0233cda..3e1b16436f70e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php @@ -21,7 +21,8 @@ use Symfony\Component\Translation\MessageCatalogue; /** - * A command that parse templates to extract translation messages and add them into the translation files. + * A command that parses templates to extract translation messages and adds them + * into the translation files. * * @author Michel Salib */ @@ -81,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $writer = $this->getContainer()->get('translation.writer'); $supportedFormats = $writer->getFormats(); if (!in_array($input->getOption('output-format'), $supportedFormats)) { - $output->error(array('Wrong output format', 'Supported formats are '.implode(', ', $supportedFormats).'.')); + $output->error(array('Wrong output format', 'Supported formats are: '.implode(', ', $supportedFormats).'.')); return 1; } @@ -111,12 +112,12 @@ protected function execute(InputInterface $input, OutputInterface $output) } } - $output->title('Symfony translation update command'); - $output->text(sprintf('Generating "%s" translation files for "%s"', $input->getArgument('locale'), $currentName)); + $output->title('Translation Messages Extractor and Dumper'); + $output->comment(sprintf('Generating "%s" translation files for "%s"', $input->getArgument('locale'), $currentName)); // load any messages from templates $extractedCatalogue = new MessageCatalogue($input->getArgument('locale')); - $output->text('Parsing templates'); + $output->comment('Parsing templates...'); $extractor = $this->getContainer()->get('translation.extractor'); $extractor->setPrefix($input->getOption('prefix')); foreach ($transPaths as $path) { @@ -128,7 +129,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // load any existing messages from the translation files $currentCatalogue = new MessageCatalogue($input->getArgument('locale')); - $output->text('Loading translation files'); + $output->comment('Loading translation files...'); $loader = $this->getContainer()->get('translation.loader'); foreach ($transPaths as $path) { $path .= 'translations'; @@ -144,18 +145,22 @@ protected function execute(InputInterface $input, OutputInterface $output) // Exit if no messages found. if (!count($operation->getDomains())) { - $output->warning('No translation found.'); + $output->warning('No translation messages were found.'); return; } // show compiled list of messages - if ($input->getOption('dump-messages') === true) { + if (true === $input->getOption('dump-messages')) { + $extractedMessagesCount = 0; $output->newLine(); foreach ($operation->getDomains() as $domain) { - $output->section(sprintf('Displaying messages for domain %s:', $domain)); $newKeys = array_keys($operation->getNewMessages($domain)); $allKeys = array_keys($operation->getMessages($domain)); + $domainMessagesCount = count($newKeys) + count($allKeys); + + $output->section(sprintf('Messages extracted for domain "%s" (%d messages)', $domain, $domainMessagesCount)); + $output->listing(array_merge( array_diff($allKeys, $newKeys), array_map(function ($id) { @@ -165,11 +170,15 @@ protected function execute(InputInterface $input, OutputInterface $output) return sprintf('%s', $id); }, array_keys($operation->getObsoleteMessages($domain))) )); + + $extractedMessagesCount += $domainMessagesCount; } if ($input->getOption('output-format') == 'xlf') { - $output->writeln('Xliff output version is 1.2'); + $output->comment('Xliff output version is 1.2'); } + + $resultMessage = sprintf('%d messages were successfully extracted', $extractedMessagesCount); } if ($input->getOption('no-backup') === true) { @@ -178,7 +187,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // save the files if ($input->getOption('force') === true) { - $output->text('Writing files'); + $output->comment('Writing files...'); $bundleTransPath = false; foreach ($transPaths as $path) { @@ -191,9 +200,14 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($bundleTransPath) { $writer->writeTranslations($operation->getResult(), $input->getOption('output-format'), array('path' => $bundleTransPath, 'default_locale' => $this->getContainer()->getParameter('kernel.default_locale'))); } + + if (true === $input->getOption('dump-messages')) { + $resultMessage .= ' and translation files were updated.'; + } else { + $resultMessage = 'Translation files were successfully updated.'; + } } - $output->newLine(); - $output->success('Success'); + $output->success($resultMessage); } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy