Example #1
0
 /**
  * Get list of translatable strings for a module.
  *
  * @param string $name
  *   Angular module name.
  * @return array
  *   Translatable strings.
  */
 public function getStrings($name)
 {
     $module = $this->getModule($name);
     $result = array();
     if (isset($module['js'])) {
         foreach ($module['js'] as $file) {
             $strings = $this->res->getStrings()->get($module['ext'], $this->res->getPath($module['ext'], $file), 'text/javascript');
             $result = array_unique(array_merge($result, $strings));
         }
     }
     if (isset($module['partials'])) {
         foreach ($module['partials'] as $partialDir) {
             $partialDir = $this->res->getPath($module['ext']) . '/' . $partialDir;
             $files = \CRM_Utils_File::findFiles($partialDir, '*.html');
             foreach ($files as $file) {
                 $strings = $this->res->getStrings()->get($module['ext'], $file, 'text/html');
                 $result = array_unique(array_merge($result, $strings));
             }
         }
     }
     return $result;
 }