/**
  * @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));
 }
 /**
  * Gives an array with all languages that needs to be imported (from the given ImportCommand)
  * If non is given, all managed locales will be used (defined in config)
  * @param  ImportCommand $importCommand
  * @return array         all locales to import by the given ImportCommand
  */
 public function determineLocalesToImport(ImportCommand $importCommand)
 {
     if ($importCommand->getLocales() === false || $importCommand->getLocales() === null) {
         return $this->managedLocales;
     }
     return $this->parseRequestedLocales($importCommand->getLocales());
 }
 public function testImportBundleTranslationFiles()
 {
     $importCommand = new ImportCommand();
     $importCommand->setForce(false)->setLocales(false)->setGlobals(true)->setDefaultBundle('own');
     $this->importCommandHandler->importBundleTranslationFiles($importCommand);
 }