Skip to content

Commit e180d81

Browse files
committed
[Translator] Add lint:translations command
1 parent 9e8bcf1 commit e180d81

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
use Symfony\Component\String\LazyString;
166166
use Symfony\Component\String\Slugger\SluggerInterface;
167167
use Symfony\Component\Translation\Bridge as TranslationBridge;
168+
use Symfony\Component\Translation\Command\TranslationLintCommand as BaseTranslationLintCommand;
168169
use Symfony\Component\Translation\Command\XliffLintCommand as BaseXliffLintCommand;
169170
use Symfony\Component\Translation\Extractor\PhpAstExtractor;
170171
use Symfony\Component\Translation\LocaleSwitcher;
@@ -245,6 +246,10 @@ public function load(array $configs, ContainerBuilder $container): void
245246
$container->removeDefinition('console.command.yaml_lint');
246247
}
247248

249+
if (!class_exists(BaseTranslationLintCommand::class)) {
250+
$container->removeDefinition('console.command.translation_lint');
251+
}
252+
248253
if (!class_exists(DebugCommand::class)) {
249254
$container->removeDefinition('console.command.dotenv_debug');
250255
}
@@ -1413,6 +1418,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
14131418
$container->removeDefinition('console.command.translation_extract');
14141419
$container->removeDefinition('console.command.translation_pull');
14151420
$container->removeDefinition('console.command.translation_push');
1421+
$container->removeDefinition('console.command.translation_lint');
14161422

14171423
return;
14181424
}

Resources/config/console.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
use Symfony\Component\Messenger\Command\StopWorkersCommand;
5555
use Symfony\Component\Scheduler\Command\DebugCommand as SchedulerDebugCommand;
5656
use Symfony\Component\Serializer\Command\DebugCommand as SerializerDebugCommand;
57+
use Symfony\Component\Translation\Command\TranslationLintCommand;
5758
use Symfony\Component\Translation\Command\TranslationPullCommand;
5859
use Symfony\Component\Translation\Command\TranslationPushCommand;
5960
use Symfony\Component\Translation\Command\XliffLintCommand;
@@ -317,6 +318,13 @@
317318
->set('console.command.yaml_lint', YamlLintCommand::class)
318319
->tag('console.command')
319320

321+
->set('console.command.translation_lint', TranslationLintCommand::class)
322+
->args([
323+
service('translator'),
324+
param('kernel.enabled_locales'),
325+
])
326+
->tag('console.command')
327+
320328
->set('console.command.form_debug', \Symfony\Component\Form\Command\DebugCommand::class)
321329
->args([
322330
service('form.registry'),

0 commit comments

Comments
 (0)