コード例 #1
0
 /**
  * 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 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);
 }
コード例 #2
0
 public function testCollectFromEntityProvidersInCustomObject()
 {
     $c = new i18nTextCollector();
     $filePath = $this->getCurrentAbsolutePath() . '/i18nTextCollectorTestMyObject.php';
     $matches = $c->collectFromEntityProviders($filePath);
     $this->assertEquals(array_keys($matches), array('i18nTextCollectorTestMyObject.PLURALNAME', 'i18nTextCollectorTestMyObject.SINGULARNAME'));
     $this->assertEquals('My Object', $matches['i18nTextCollectorTestMyObject.SINGULARNAME'][0]);
 }