Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 14d458d

Browse files
feature #29850 [FrameworkBundle] xliff-version option to translation update command (andrewwro)
This PR was squashed before being merged into the 4.3-dev branch (closes #29850). Discussion ---------- [FrameworkBundle] xliff-version option to translation update command | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | no <!-- please add some, will be required by reviewers --> | License | MIT New 'version' option added to xliff translation update command. Currently xliff version is hardcoded to 1.2. Commits ------- 4ec28bd [FrameworkBundle] xliff-version option to translation update command
2 parents a9f8ca5 + 4ec28bd commit 14d458d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ protected function configure()
7373
new InputOption('no-backup', null, InputOption::VALUE_NONE, 'Should backup be disabled'),
7474
new InputOption('clean', null, InputOption::VALUE_NONE, 'Should clean not found messages'),
7575
new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'Specify the domain to update'),
76+
new InputOption('xliff-version', null, InputOption::VALUE_OPTIONAL, 'Override the default xliff version', '1.2'),
7677
])
7778
->setDescription('Updates the translation file')
7879
->setHelp(<<<'EOF'
@@ -262,7 +263,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
262263
}
263264

264265
if ('xlf' === $input->getOption('output-format')) {
265-
$errorIo->comment('Xliff output version is <info>1.2</info>');
266+
$errorIo->comment(sprintf('Xliff output version is <info>%s</info>', $input->getOption('xliff-version')));
266267
}
267268

268269
$resultMessage = sprintf('%d message%s successfully extracted', $extractedMessagesCount, $extractedMessagesCount > 1 ? 's were' : ' was');
@@ -287,7 +288,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
287288
$bundleTransPath = end($transPaths);
288289
}
289290

290-
$this->writer->write($operation->getResult(), $input->getOption('output-format'), ['path' => $bundleTransPath, 'default_locale' => $this->defaultLocale]);
291+
$this->writer->write($operation->getResult(), $input->getOption('output-format'), ['path' => $bundleTransPath, 'default_locale' => $this->defaultLocale, 'xliff_version' => $input->getOption('xliff-version')]);
291292

292293
if (true === $input->getOption('dump-messages')) {
293294
$resultMessage .= ' and translation files were updated';

0 commit comments

Comments
 (0)