Skip to content
Snippets Groups Projects
Commit a7482227 authored by Vincent Petry's avatar Vincent Petry
Browse files

Merge pull request #12464 from owncloud/cache-available-languages

Cache results of available languages
parents 51190f71 b20d698e
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,7 @@ class OC_L10N implements \OCP\IL10N { ...@@ -20,6 +20,7 @@ class OC_L10N implements \OCP\IL10N {
* cache * cache
*/ */
protected static $cache = array(); protected static $cache = array();
protected static $availableLanguages = array();
/** /**
* The best language * The best language
...@@ -468,6 +469,9 @@ class OC_L10N implements \OCP\IL10N { ...@@ -468,6 +469,9 @@ class OC_L10N implements \OCP\IL10N {
* @return array an array of available languages * @return array an array of available languages
*/ */
public static function findAvailableLanguages($app=null) { public static function findAvailableLanguages($app=null) {
if(!empty(self::$availableLanguages)) {
return self::$availableLanguages;
}
$available=array('en');//english is always available $available=array('en');//english is always available
$dir = self::findI18nDir($app); $dir = self::findI18nDir($app);
if(is_dir($dir)) { if(is_dir($dir)) {
...@@ -479,6 +483,8 @@ class OC_L10N implements \OCP\IL10N { ...@@ -479,6 +483,8 @@ class OC_L10N implements \OCP\IL10N {
} }
} }
} }
self::$availableLanguages = $available;
return $available; return $available;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment