/** * @Route("/import-forced", name="KunstmaanTranslatorBundle_command_import_forced") */ public function importForcedAction() { $importCommand = new ImportCommand(); $importCommand->setForce(true)->setDefaultBundle($this->container->getParameter('kuma_translator.default_bundle'))->setBundles($this->container->getParameter('kuma_translator.bundles'))->setGlobals(false); $this->get('kunstmaan_translator.service.importer.command_handler')->executeImportCommand($importCommand); $this->get('session')->getFlashBag()->add(FlashTypes::SUCCESS, $this->get('translator')->trans('kuma_translator.command.import.flash.force_success')); return new RedirectResponse($this->generateUrl('KunstmaanTranslatorBundle_settings_translations')); }
/** * @Route("/import-forced", name="KunstmaanTranslatorBundle_command_import_forced") */ public function importForcedAction() { $importCommand = new ImportCommand(); $importCommand->setForce(true)->setDefaultBundle($this->container->getParameter('kuma_translator.default_bundle'))->setBundles($this->container->getParameter('kuma_translator.bundles'))->setGlobals(false); $this->get('kunstmaan_translator.service.importer.command_handler')->executeImportCommand($importCommand); $this->get('session')->getFlashBag()->add('success', 'Translations successfully imported, all existing translations were overwritten.'); return new RedirectResponse($this->generateUrl('KunstmaanTranslatorBundle_settings_translations')); }
protected function execute(InputInterface $input, OutputInterface $output) { $force = $input->getOption('force'); $locales = $input->getOption('locales'); $globals = $input->getOption('globals'); $defaultBundle = $input->getOption('defaultbundle'); $bundles = $input->hasOption('bundles') ? array_map('trim', explode(',', $input->getOption('bundles'))) : array(); $importCommand = new ImportCommand(); $importCommand->setForce($force)->setLocales($locales)->setGlobals($globals)->setDefaultBundle($defaultBundle)->setBundles($bundles); $imported = $this->getContainer()->get('kunstmaan_translator.service.importer.command_handler')->executeImportCommand($importCommand); $output->writeln(sprintf("Translation imported: %d", $imported)); }
public function testImportBundleTranslationFiles() { $importCommand = new ImportCommand(); $importCommand->setForce(false)->setLocales(false)->setGlobals(true)->setDefaultBundle('own'); $this->importCommandHandler->importBundleTranslationFiles($importCommand); }