Version: current

     1 <?php
     2 /**
     3  * @package sapphire
     4  * @subpackage tasks
     5  */
     6 class i18nTextCollectorTask extends BuildTask {
     7
     8     protected $title = "i18n Textcollector Task";
     9
    10     protected $description = "
    11         Traverses through files in order to collect the 'entity master tables'
    12         stored in each module.
    13     ";
    14
    15     function init() {
    16         parent::init();
    17
    18         $canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
    19         if(!$canAccess) return Security::permissionFailure($this);
    20     }
    21
    22     /**
    23      * This is the main method to build the master string tables with the original strings.
    24      * It will search for existent modules that use the i18n feature, parse the _t() calls
    25      * and write the resultant files in the lang folder of each module.
    26      *
    27      * @uses DataObject->collectI18nStatics()
    28      */
    29     public function run($request) {
    30         increase_time_limit_to();
    31         $locale = ($request->getVar('locale')) ? $request->getVar('locale') : null;
    32         $c = new i18nTextCollector($locale);
    33         $restrictModules = ($request->getVar('module')) ? explode(',', $request->getVar('module')) : null;
    34         return $c->run($restrictModules);
    35     }
    36 }
    37 ?>

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -