Skip to content

Commit 4ec28bd

Browse files
andrewwronicolas-grekas
authored andcommitted
[FrameworkBundle] xliff-version option to translation update command
1 parent db6784b commit 4ec28bd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

+3-2
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)