protected function execute(InputInterface $input, OutputInterface $output)
 {
     $languages = explode(",", $input->getArgument('languages'));
     $finder = new Finder();
     $finder->files()->in(__DIR__ . "/../../datas/");
     $output_path = __DIR__ . "/../../output/";
     $datas_path = __DIR__ . "/../../datas/";
     $key = $input->getArgument('base_language');
     copy($datas_path . "messages.{$key}.yml", $output_path . "messages.{$key}.yml");
     $input = $datas_path . "messages.{$key}.yml";
     foreach ($languages as $lang) {
         $lang = trim($lang);
         $output = $output_path . "messages.{$lang}.yml";
         $origin = $datas_path . "messages.{$lang}.yml";
         $translator = new Translator($key, $input, $output);
         $translator->setLang($lang);
         $yaml = Yaml::parse($input);
         $dumper = new Dumper();
         $copy_yaml = Yaml::parse($origin);
         if (is_array($copy_yaml)) {
             $translator->readAndTranslate($yaml, '', $copy_yaml);
             file_put_contents($output, $dumper->dump($copy_yaml, 2));
         } else {
             $copy_yaml = $yaml;
             $test = Translator::eraseValues($copy_yaml);
             $translator->readAndTranslate($yaml, '', $test);
             file_put_contents($output, $dumper->dump($test, 2));
         }
     }
 }
 public function testinstanceOfTranslator()
 {
     $lang = "fr";
     $input = __DIR__ . "/../Fixtures/datas/test.{$lang}.yml";
     $output = __DIR__ . "/../Fixtures/output/test.en.yml";
     $origin = __DIR__ . "/../Fixtures/datas/test.en.yml";
     $translator = new Translator($lang, $input, $output);
     $translator->setLang("en");
     $yaml = Yaml::parse($input);
     $dumper = new Dumper();
     $copy_yaml = Yaml::parse($origin);
     if (is_array($copy_yaml)) {
         $translator->readAndTranslate($yaml, '', $copy_yaml);
         file_put_contents($output, $dumper->dump($copy_yaml, 2));
     } else {
         $copy_yaml = $yaml;
         $test = $translator->eraseValues($copy_yaml);
         $translator->readAndTranslate($yaml, '', $test);
         file_put_contents($output, $dumper->dump($test, 2));
     }
     $this->assertTrue($translator instanceof Translator);
 }