/**
  * @see sfTask
  */
 public function execute($arguments = array(), $options = array())
 {
     $this->logSection('i18n', sprintf('extracting i18n strings for the "%s" application', $arguments['application']));
     // get i18n configuration from factories.yml
     $config = sfFactoryConfigHandler::getConfiguration($this->configuration->getConfigPaths('config/factories.yml'));
     $class = $config['i18n']['class'];
     $params = $config['i18n']['param'];
     unset($params['cache']);
     $extract = new sfI18nApplicationExtract(new $class($this->configuration, new sfNoCache(), $params), $arguments['culture']);
     $extract->extract();
     $this->logSection('i18n', sprintf('found "%d" new i18n strings', count($extract->getNewMessages())));
     $this->logSection('i18n', sprintf('found "%d" old i18n strings', count($extract->getOldMessages())));
     if ($options['display-new']) {
         $this->logSection('i18n', sprintf('display "%d" new i18n strings', count($extract->getOldMessages())));
         foreach ($extract->getNewMessages() as $message) {
             $this->log('               ' . $message . "\n");
         }
     }
     if ($options['auto-save']) {
         $this->logSection('i18n', 'saving new i18n strings');
         $extract->saveNewMessages();
     }
     if ($options['display-old']) {
         $this->logSection('i18n', sprintf('display "%d" old i18n strings', count($extract->getOldMessages())));
         foreach ($extract->getOldMessages() as $message) {
             $this->log('               ' . $message . "\n");
         }
     }
     if ($options['auto-delete']) {
         $this->logSection('i18n', 'deleting old i18n strings');
         $extract->deleteOldMessages();
     }
 }
 /**
  * @see sfTask
  */
 public function execute($arguments = array(), $options = array())
 {
     $this->logSection('i18n', sprintf('extracting i18n strings for the "%s" application', $options['application']));
     // get i18n configuration from factories.yml
     $config = sfFactoryConfigHandler::getConfiguration($this->configuration->getConfigPaths('config/factories.yml'));
     $class = $config['i18n']['class'];
     $params = $config['i18n']['param'];
     unset($params['cache']);
     $extract = new sfI18nApplicationExtract(new $class($this->configuration, new sfNoCache(), $params), $arguments['culture']);
     $extract->extract();
     $this->logSection('i18n', sprintf('found "%d" new i18n strings', count($extract->getNewMessages())));
     $this->logSection('i18n', sprintf('found "%d" old i18n strings', count($extract->getOldMessages())));
     if ($options['display-new']) {
         $this->logSection('i18n', sprintf('display new i18n strings', count($extract->getOldMessages())));
         foreach ($extract->getNewMessages() as $message) {
             $this->log('               ' . $message . "\n");
         }
     }
     if ($options['auto-save']) {
         $this->logSection('i18n', 'saving new i18n strings');
         $extract->saveNewMessages();
     }
     if ($options['display-old']) {
         $this->logSection('i18n', sprintf('display old i18n strings', count($extract->getOldMessages())));
         foreach ($extract->getOldMessages() as $message) {
             $this->log('               ' . $message . "\n");
         }
     }
     if ($options['auto-delete']) {
         $this->logSection('i18n', 'deleting old i18n strings');
         $extract->deleteOldMessages();
     }
     // Extract plugin strings
     if ($options['plugins']) {
         unset($options['plugins']);
         $pluginNames = sfFinder::type('dir')->maxdepth(0)->relative()->not_name('.')->in(sfConfig::get('sf_plugins_dir'));
         foreach ($pluginNames as $pluginName) {
             $extractPlugin = new sfI18nExtractPluginTask($this->dispatcher, $this->formatter);
             $extractPlugin->setCommandApplication($this->commandApplication);
             $extractPlugin->setConfiguration($this->configuration);
             $ret = $extractPlugin->run(array('plugin' => $pluginName, 'culture' => $arguments['culture']), $options);
             if ($ret) {
                 return $ret;
             }
         }
     }
 }
 /**
  * @see sfTask
  * @see sfI18nExtract
  */
 public function execute($arguments = array(), $options = array())
 {
     $output = "";
     if (strtolower($options['file']) != 'stdout') {
         $this->logSection('i18n', sprintf('Diff i18n strings for the "%s" application', $arguments['application']));
     }
     // get i18n configuration from factories.yml
     $config = sfFactoryConfigHandler::getConfiguration($this->configuration->getConfigPaths('config/factories.yml'));
     $class = $config['i18n']['class'];
     $params = $config['i18n']['param'];
     unset($params['cache']);
     $this->i18n = new $class($this->configuration, new sfNoCache(), $params);
     $extract = new sfI18nApplicationExtract($this->i18n, $arguments['culture']);
     $extract->extract();
     if (strtolower($options['file']) != 'stdout') {
         $this->logSection('i18n', sprintf('found "%d" new i18n strings', count($extract->getNewMessages())));
         $this->logSection('i18n', sprintf('found "%d" old i18n strings', count($extract->getOldMessages())));
     }
     // Column headers
     $rows[0] = array('Action', 'Source', 'Target');
     // Old messages
     foreach ($this->getOldTranslations($extract) as $source => $target) {
         $rows[] = array('Removed', $source, $target);
     }
     // New messages
     foreach ($extract->getNewMessages() as $message) {
         $rows[] = array('Added', $message);
     }
     // Choose output format
     switch (strtolower($options['format'])) {
         case 'csv':
             foreach ($rows as $row) {
                 $output .= '"' . implode('","', array_map('addslashes', $row)) . "\"\n";
             }
             break;
         case 'tab':
             foreach ($rows as $row) {
                 $output .= implode("\t", $row) . "\n";
             }
             break;
     }
     // Output file
     if (strtolower($options['file']) != 'stdout') {
         echo "\n" . $options['file'];
         // Remove '=' if using -f="file.csv" notation
         $filename = substr($options['file'], 0, 1) == '=' ? substr($options['file'], 1) : $options['file'];
         file_put_contents($filename, $output);
     } else {
         echo $output;
     }
 }