Ejemplo n.º 1
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $htmlentities = !$this->input->getOption('no-entities');
     $this->info("It's time to DIGG for some translations!");
     $this->info(' ');
     foreach ($this->manager->getDiggFiles() as $file) {
         $path = str_replace(base_path() . '/', '', $file);
         $this->comment("Digging translations for {$path}");
         foreach ($this->getTranlations($file) as $translate) {
             if (!$translate['valid'] and !$this->confirm('Translation "' . $translate['lang_query'] . '" seems wrong. Want to try to translate it anyway? [yes|no]')) {
                 continue;
             }
             foreach ($this->manager->getLanguages() as $language) {
                 $lang_query = array_get($translate, 'lang_query');
                 $parameters = array_get($translate, 'parameters');
                 $group = array_get($translate, 'group');
                 $line = array_get($translate, 'line');
                 if (Lang::get($lang_query, $parameters) == $lang_query) {
                     if (is_null($translation = $this->ask("Translate '{$lang_query}'" . (!empty($parameters) ? " [" . implode(',', $parameters) . "]" : null) . " in " . strtoupper($language) . ": "))) {
                         continue;
                     }
                     $this->manager->setLanguage($language)->addLine($group, $line, $translation, $htmlentities);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $bench = $this->input->getOption('bench');
     $htmlentities = !$this->input->getOption('no-entities');
     $group = $this->input->getArgument('group');
     $line = $this->input->getArgument('line');
     if ($bench) {
         $this->manager->workbench($bench);
     }
     foreach ($this->manager->getLanguages() as $language) {
         if (is_null($translation = $this->ask("Translate '{$line}' in " . strtoupper($language) . ": "))) {
             continue;
         }
         $this->manager->setLanguage($language)->addLine($group, $line, $translation, $htmlentities);
         $this->createExample($group, $line, $translation);
     }
     $this->info('Translation added!');
     $this->showExamples();
 }