diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
index a9a004735b..72298480b4 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
@@ -160,11 +160,8 @@ EOF
foreach ($operation->getDomains() as $domain) {
$newKeys = array_keys($operation->getNewMessages($domain));
$allKeys = array_keys($operation->getMessages($domain));
- $domainMessagesCount = count($newKeys) + count($allKeys);
- $io->section(sprintf('Messages extracted for domain "%s" (%d messages)', $domain, $domainMessagesCount));
-
- $io->listing(array_merge(
+ $list = array_merge(
array_diff($allKeys, $newKeys),
array_map(function ($id) {
return sprintf('%s>', $id);
@@ -172,7 +169,12 @@ EOF
array_map(function ($id) {
return sprintf('%s>', $id);
}, array_keys($operation->getObsoleteMessages($domain)))
- ));
+ );
+
+ $domainMessagesCount = count($list);
+
+ $io->section(sprintf('Messages extracted for domain "%s" (%d message%s)', $domain, $domainMessagesCount, $domainMessagesCount > 1 ? 's' : ''));
+ $io->listing($list);
$extractedMessagesCount += $domainMessagesCount;
}
@@ -181,7 +183,7 @@ EOF
$io->comment('Xliff output version is 1.2');
}
- $resultMessage = sprintf('%d messages were successfully extracted', $extractedMessagesCount);
+ $resultMessage = sprintf('%d message%s successfully extracted', $extractedMessagesCount, $extractedMessagesCount > 1 ? 's were' : ' was');
}
if ($input->getOption('no-backup') === true) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
index f7eca9d366..40eab748c6 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
@@ -28,6 +28,15 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
$tester = $this->createCommandTester($this->getContainer(array('foo' => 'foo')));
$tester->execute(array('command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true));
$this->assertRegExp('/foo/', $tester->getDisplay());
+ $this->assertRegExp('/1 message was successfully extracted/', $tester->getDisplay());
+ }
+
+ public function testDumpTwoMessagesAndClean()
+ {
+ $tester = $this->createCommandTester($this->getContainer(array('foo' => 'foo', 'bar' => 'bar')));
+ $tester->execute(array('command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true));
+ $this->assertRegExp('/foo/', $tester->getDisplay());
+ $this->assertRegExp('/bar/', $tester->getDisplay());
$this->assertRegExp('/2 messages were successfully extracted/', $tester->getDisplay());
}