Exemplo n.º 1
0
 /**
  * Add translations as translation units found in a structure.xml manifest
  * a given PO file.
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param tao_helpers_translation_POFile $poFile
  * @throws Exception
  * @return void
  */
 public function addManifestsTranslations(tao_helpers_translation_POFile $poFile)
 {
     $this->outVerbose("Adding all manifests messages to extension '" . $this->options['extension'] . "'");
     $rootDir = dirname(__FILE__) . '/../../';
     $directories = scandir($rootDir);
     $exceptions = array('generis', 'tao', '.*');
     if (false === $directories) {
         $this->err("The TAO root directory is not readable. Please check permissions on this directory.", true);
     } else {
         foreach ($directories as $dir) {
             if (is_dir($rootDir . $dir) && !in_array($dir, $exceptions)) {
                 // Maybe it should be read.
                 if (in_array('.*', $exceptions) && $dir[0] == '.') {
                     continue;
                 } else {
                     // Is this a TAO extension ?
                     $file = MenuService::getStructuresFilePath($this->options['extension']);
                     if (!is_null($file)) {
                         $structureExtractor = new tao_helpers_translation_StructureExtractor(array($file));
                         $structureExtractor->extract();
                         $poFile->addTranslationUnits($structureExtractor->getTranslationUnits());
                         $this->outVerbose("Manifest of extension '" . $dir . "' added to extension '" . $this->options['extension'] . "'");
                     }
                 }
             }
         }
     }
 }