Browse Source

Message clair si listage des langues impossible

Christophe HENRY 7 years ago
parent
commit
b46c20fb77
1 changed files with 10 additions and 6 deletions
  1. 10 6
      i18n.php

+ 10 - 6
i18n.php

@@ -36,13 +36,17 @@ class Translation {
 
     /* Peuple la liste des langues avec une traduction */
     protected function listLanguages() {
-        $files = glob($this->location.'/'.self::LOCALE_DIR.'/*.json');
-        assert('is_array($files)');
         $this->languages = array();
-        foreach($files as $file){
-            preg_match('/([a-z]{2})\.json$/', $file, $matches);
-            assert('!empty($matches)');
-            $this->languages [] = $matches[1];
+        $dir = $this->location.'/'.self::LOCALE_DIR.'/*.json';
+        $files = glob($dir);
+        if (is_array($files)) {
+            foreach($files as $file){
+                preg_match('/([a-z]{2})\.json$/', $file, $matches);
+                assert('!empty($matches)');
+                $this->languages [] = $matches[1];
+            }
+        } else {
+            error_log("Unable to browse the language files! ($dir)");
         }
     }