public function fire() { increase_memory_limit_to(); increase_time_limit_to(); /** @var i18nTextCollector $collector */ $collector = i18nTextCollector::create($this->option('locale')); if (!$this->option('locale')) { $this->info('Starting text collection. No Locale specified'); } else { $this->info('Starting text collection for: ' . $this->option('locale')); } $merge = $this->getIsMerge(); if ($merge) { $this->info('New strings will be merged with existing strings'); } // Custom writer $writerName = $this->option('writer'); if ($writerName) { $writer = Injector::inst()->get($writerName); $collector->setWriter($writer); $this->info('Set collector writer to: ' . $writer); } // Get restrictions $restrictModules = $this->option('module') ? explode(',', $this->option('module')) : null; $this->info('Collecting in modules: ' . $this->option('module')); // hack untill we have something better ob_start(); $collector->run($restrictModules, $merge); $this->warn(ob_get_contents()); ob_get_clean(); $this->info(__CLASS__ . ' completed!'); }
/** * This is the main method to build the master string tables with the original strings. * It will search for existent modules that use the i18n feature, parse the _t() calls * and write the resultant files in the lang folder of each module. * * @uses DataObject->collectI18nStatics() * * @param SS_HTTPRequest $request */ public function run($request) { increase_time_limit_to(); $collector = i18nTextCollector::create($request->getVar('locale')); $merge = $this->getIsMerge($request); // Custom writer $writerName = $request->getVar('writer'); if ($writerName) { $writer = Injector::inst()->get($writerName); $collector->setWriter($writer); } // Get restrictions $restrictModules = $request->getVar('module') ? explode(',', $request->getVar('module')) : null; $collector->run($restrictModules, $merge); Debug::message(__CLASS__ . " completed!", false); }