コード例 #1
0
 /**
  * Fetches the list of available translations, as an eZTSTranslator for each translation.
  *
  * @param array $localList
  *
  * @return array( eZTSTranslator ) list of eZTranslator objects representing available translations
  */
 static function fetchList($localeList = array())
 {
     $ini = eZINI::instance();
     $dir = $ini->variable('RegionalSettings', 'TranslationRepository');
     $fileInfoList = array();
     $translationList = array();
     $locale = '';
     if (count($localeList) == 0) {
         $localeList = eZDir::findSubdirs($dir);
     }
     foreach ($localeList as $locale) {
         if ($locale != 'untranslated') {
             $translationFiles = eZDir::findSubitems($dir . '/' . $locale, 'f');
             foreach ($translationFiles as $translationFile) {
                 if (eZFile::suffix($translationFile) == 'ts') {
                     $translationList[] = new eZTSTranslator($locale, $translationFile);
                 }
             }
         }
     }
     return $translationList;
 }