2008-10-16 22:42:41 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2012-04-12 08:02:46 +02:00
|
|
|
* @package framework
|
2008-10-16 22:42:41 +02:00
|
|
|
* @subpackage tasks
|
|
|
|
*/
|
|
|
|
class i18nTextCollectorTask extends BuildTask {
|
|
|
|
|
|
|
|
protected $title = "i18n Textcollector Task";
|
|
|
|
|
|
|
|
protected $description = "
|
|
|
|
Traverses through files in order to collect the 'entity master tables'
|
|
|
|
stored in each module.
|
|
|
|
";
|
|
|
|
|
|
|
|
function init() {
|
|
|
|
parent::init();
|
2009-09-10 03:49:56 +02:00
|
|
|
|
|
|
|
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
|
|
|
if(!$canAccess) return Security::permissionFailure($this);
|
2008-10-16 22:42:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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()
|
|
|
|
*/
|
|
|
|
public function run($request) {
|
2009-06-28 04:36:46 +02:00
|
|
|
increase_time_limit_to();
|
2012-04-15 21:49:51 +02:00
|
|
|
$c = new i18nTextCollector($request->getVar('locale'));
|
|
|
|
$writer = $request->getVar('writer');
|
|
|
|
if($writer) $c->setWriter(new $writer());
|
2009-01-05 07:19:48 +01:00
|
|
|
$restrictModules = ($request->getVar('module')) ? explode(',', $request->getVar('module')) : null;
|
|
|
|
return $c->run($restrictModules);
|
2008-10-16 22:42:41 +02:00
|
|
|
}
|
|
|
|
}
|