Skip to content

Commit

Permalink
feature #29850 [FrameworkBundle] xliff-version option to translation …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
nicolas-grekas committed Jan 24, 2019
2 parents a9f8ca5 + 4ec28bd commit 14d458d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ protected function configure()
new InputOption('no-backup', null, InputOption::VALUE_NONE, 'Should backup be disabled'),
new InputOption('clean', null, InputOption::VALUE_NONE, 'Should clean not found messages'),
new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'Specify the domain to update'),
new InputOption('xliff-version', null, InputOption::VALUE_OPTIONAL, 'Override the default xliff version', '1.2'),
])
->setDescription('Updates the translation file')
->setHelp(<<<'EOF'
Expand Down Expand Up @@ -262,7 +263,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

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

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

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

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

0 comments on commit 14d458d

Please sign in to comment.