$this->transPaths =
$transPaths;
$this->codePaths =
$codePaths;
$this->enabledLocales =
$enabledLocales;
} protected function configure(): void
{ $this ->
setDefinition([ new InputArgument('locale', InputArgument::REQUIRED, 'The locale'
),
new InputArgument('bundle', InputArgument::OPTIONAL, 'The bundle name or directory where to load the messages'
),
new InputOption('prefix', null, InputOption::VALUE_OPTIONAL, 'Override the default prefix', '__'
),
new InputOption('format', null, InputOption::VALUE_OPTIONAL, 'Override the default output format', 'xlf12'
),
new InputOption('dump-messages', null, InputOption::VALUE_NONE, 'Should the messages be dumped in the console'
),
new InputOption('force', null, InputOption::VALUE_NONE, 'Should the extract be done'
),
new InputOption('clean', null, InputOption::VALUE_NONE, 'Should clean not found messages'
),
new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'Specify the domain to extract'
),
new InputOption('sort', null, InputOption::VALUE_OPTIONAL, 'Return list of messages sorted alphabetically (only works with --dump-messages)', 'asc'
),
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'
),
]) ->
setHelp(<<<'EOF'
The <info>%command.name%</info> command extracts translation strings from templates
of a given bundle or the default translations directory. It can display them or merge
the new ones into the translation files.
When new translation strings are found it can automatically add a prefix to the translation
message.
Example running against a Bundle (AcmeBundle)
<info>php %command.full_name% --dump-messages en AcmeBundle</info>
<info>php %command.full_name% --force --prefix="new_" fr AcmeBundle</info>
Example running against default messages directory
<info>php %command.full_name% --dump-messages en</info>
<info>php %command.full_name% --force --prefix="new_" fr</info>
You can sort the output with the <comment>--sort</> flag:
<info>php %command.full_name% --dump-messages --sort=asc en AcmeBundle</info>
<info>php %command.full_name% --dump-messages --sort=desc fr</info>
You can dump a tree-like structure using the yaml format with <comment>--as-tree</> flag:
<info>php %command.full_name% --force --format=yaml --as-tree=3 en AcmeBundle</info>