|
17 | 17 | use Symfony\Component\Console\Input\InputArgument;
|
18 | 18 | use Symfony\Component\Console\Input\InputInterface;
|
19 | 19 | use Symfony\Component\Console\Input\InputOption;
|
| 20 | +use Symfony\Component\Console\Output\ConsoleOutputInterface; |
20 | 21 | use Symfony\Component\Console\Output\OutputInterface;
|
21 | 22 | use Symfony\Component\Console\Style\SymfonyStyle;
|
22 | 23 | use Symfony\Component\HttpKernel\KernelInterface;
|
|
36 | 37 | *
|
37 | 38 | * @final
|
38 | 39 | */
|
39 |
| -#[AsCommand(name: 'translation:update', description: 'Update the translation file')] |
| 40 | +#[AsCommand(name: 'translation:extract', description: 'Extract missing translations keys from code to translation files.')] |
40 | 41 | class TranslationUpdateCommand extends Command
|
41 | 42 | {
|
42 | 43 | private const ASC = 'asc';
|
@@ -78,9 +79,9 @@ protected function configure()
|
78 | 79 | new InputOption('prefix', null, InputOption::VALUE_OPTIONAL, 'Override the default prefix', '__'),
|
79 | 80 | new InputOption('format', null, InputOption::VALUE_OPTIONAL, 'Override the default output format', 'xlf12'),
|
80 | 81 | new InputOption('dump-messages', null, InputOption::VALUE_NONE, 'Should the messages be dumped in the console'),
|
81 |
| - new InputOption('force', null, InputOption::VALUE_NONE, 'Should the update be done'), |
| 82 | + new InputOption('force', null, InputOption::VALUE_NONE, 'Should the extract be done'), |
82 | 83 | new InputOption('clean', null, InputOption::VALUE_NONE, 'Should clean not found messages'),
|
83 |
| - new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'Specify the domain to update'), |
| 84 | + new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'Specify the domain to extract'), |
84 | 85 | new InputOption('sort', null, InputOption::VALUE_OPTIONAL, 'Return list of messages sorted alphabetically', 'asc'),
|
85 | 86 | new InputOption('as-tree', null, InputOption::VALUE_OPTIONAL, 'Dump the messages as a tree-like structure: The given value defines the level where to switch to inline YAML'),
|
86 | 87 | ])
|
@@ -122,6 +123,13 @@ protected function configure()
|
122 | 123 | */
|
123 | 124 | protected function execute(InputInterface $input, OutputInterface $output): int
|
124 | 125 | {
|
| 126 | + $io = new SymfonyStyle($input, $output); |
| 127 | + $errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io; |
| 128 | + |
| 129 | + if ('translation:update' === $input->getFirstArgument()) { |
| 130 | + $errorIo->caution('Command "translation:update" is deprecated since version 5.4 and will be removed in Symfony 6.0. Use "translation:extract" instead.'); |
| 131 | + } |
| 132 | + |
125 | 133 | $io = new SymfonyStyle($input, $output);
|
126 | 134 | $errorIo = $io->getErrorStyle();
|
127 | 135 |
|
|
0 commit comments