Locale setting for the Translator

This commit is contained in:
Ilyas Salikhov 2014-10-24 12:17:35 +04:00
parent c6db0af5d4
commit 73284a721f

View File

@ -35,6 +35,7 @@ class DumpCommand extends ContainerAwareCommand
)
->addOption('no-sandbox', '', InputOption::VALUE_NONE)
->addOption('api-version', null, InputOption::VALUE_REQUIRED, 'The API version')
->addOption('locale', null, InputOption::VALUE_REQUIRED, 'Locale for translation')
->setName('api:doc:dump')
;
}
@ -54,6 +55,10 @@ class DumpCommand extends ContainerAwareCommand
$formatter = $this->getContainer()->get(sprintf('nelmio_api_doc.formatter.%s_formatter', $format));
}
if ($input->hasOption('locale')) {
$this->getContainer()->get('translator')->setLocale($input->getOption('locale'));
}
if ($input->getOption('no-sandbox') && 'html' === $format) {
$formatter->setEnableSandbox(false);
}