Exemplo n.º 1
0
 /**
  * find all available languages for an app
  * @param string $app App that needs to be translated
  * @return array an array of available languages
  */
 public static function findAvailableLanguages($app = null)
 {
     if (!empty(self::$availableLanguages)) {
         return self::$availableLanguages;
     }
     $available = array('en');
     //english is always available
     $dir = self::findI18nDir($app);
     if (is_dir($dir)) {
         $files = scandir($dir);
         foreach ($files as $file) {
             if (substr($file, -5, 5) === '.json' && substr($file, 0, 4) !== 'l10n') {
                 $i = substr($file, 0, -5);
                 $available[] = $i;
             }
         }
     }
     self::$availableLanguages = $available;
     return $available;
 }