8000 feature #23161 [FrameworkBundle] Deprecate useless --no-prefix option… · symfony/framework-bundle@5198e22 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5198e22

Browse files
committed
feature #23161 [FrameworkBundle] Deprecate useless --no-prefix option (chalasr)
This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] Deprecate useless --no-prefix option | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a It was a workaround, not needed since symfony/symfony#21228. Let's deprecate it and remove it in 4.0. Commits ------- f7afa777d8 [FrameworkBundle] Deprecate useless --no-prefix option
2 parents 9cb8efb + 0c7317f commit 5198e22

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Command/TranslationUpdateCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected function configure()
3939
new InputArgument('locale', InputArgument::REQUIRED, 'The locale'),
4040
new InputArgument('bundle', InputArgument::OPTIONAL, 'The bundle name or directory where to load the messages, defaults to app/Resources folder'),
4141
new InputOption('prefix', null, InputOption::VALUE_OPTIONAL, 'Override the default prefix', '__'),
42-
new InputOption('no-prefix', null, InputOption::VALUE_NONE, 'If set, no prefix is added to the translations'),
42+
new InputOption('no-prefix', null, InputOption::VALUE_NONE, '[DEPRECATED] If set, no prefix is added to the translations'),
4343
new InputOption('output-format', null, InputOption::VALUE_OPTIONAL, 'Override the default output format', 'yml'),
4444
new InputOption('dump-messages', null, InputOption::VALUE_NONE, 'Should the messages be dumped in the console'),
4545
new InputOption('force', null, InputOption::VALUE_NONE, 'Should the update be done'),
@@ -135,7 +135,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
135135
$extractedCatalogue = new MessageCatalogue($input->getArgument('locale'));
136136
$errorIo->comment('Parsing templates...');
137137
$extractor = $this->getContainer()->get('translation.extractor');
138-
$extractor->setPrefix($input->getOption('no-prefix') ? '' : $input->getOption('prefix'));
138+
$prefix = $input->getOption('prefix');
139+
// @deprecated since version 3.4, to be removed in 4.0 along with the --no-prefix option
140+
if ($input->getOption('no-prefix')) {
141+
@trigger_ 5B4D error('The "--no-prefix" option is deprecated since version 3.4 and will be removed in 4.0. Use the "--prefix" option with an empty string as value instead.', E_USER_DEPRECATED);
142+
$prefix = '';
143+
}
144+
$extractor->setPrefix($prefix);
139145
foreach ($transPaths as $path) {
140146
$path .= 'views';
141147
if (is_dir($path)) {

0 commit comments

Comments
 (0)
0