10000 bug #35486 [Translator] Default value for 'sort' option in translatio… · symfony/symfony@55df55e · GitHub
[go: up one dir, main page]

Skip to content

Commit 55df55e

Browse files
committed
bug #35486 [Translator] Default value for 'sort' option in translation:update should be 'asc' (versgui)
This PR was squashed before being merged into the 4.4 branch (closes #35486). Discussion ---------- [Translator] Default value for 'sort' option in translation:update should be 'asc' | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | The value for 'sort' option for `bin/console translation:update --sort` is optional, but no default value is defined. So the list isn't sorted if no value is explicitly defined. This MR brings a default value "asc" if no value is defined, so the list is correctly sorted. Commits ------- fdb13c8 [Translator] Default value for 'sort' option in translation:update should be 'asc'
2 parents 9803f3e + fdb13c8 commit 55df55e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function configure()
8383
new InputOption('clean', null, InputOption::VALUE_NONE, 'Should clean not found messages'),
8484
new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'Specify the domain to update'),
8585
new InputOption('xliff-version', null, InputOption::VALUE_OPTIONAL, 'Override the default xliff version', '1.2'),
86-
new InputOption('sort', null, InputOption::VALUE_OPTIONAL, 'Return list of messages sorted alphabetically'),
86+
new InputOption('sort', null, InputOption::VALUE_OPTIONAL, 'Return list of messages sorted alphabetically', 'asc'),
8787
])
8888
->setDescription('Updates the translation file')
8989
->setHelp(<<<'EOF'

src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ public function testDumpReverseSortedMessagesAndClean()
4848
$this->assertRegExp('/3 messages were successfully extracted/', $tester->getDisplay());
4949
}
5050

51+
public function testDumpSortWithoutValueAndClean()
52+
{
53+
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]);
54+
$tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true, '--sort']);
55+
$this->assertRegExp("/\*bar\*foo\*test/", preg_replace('/\s+/', '', $tester->getDisplay()));
56+
$this->assertRegExp('/3 messages were successfully extracted/', $tester->getDisplay());
57+
}
58+
5159
public function testDumpWrongSortAndClean()
5260
{
5361
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]);

0 commit comments

Comments
 (0)
0