From 5a2b30d78f1a5cb1879a453a9ac43cd5fa1de90c Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 30 Sep 2015 16:49:16 +0200 Subject: cache found l10n per app and not globally * fixes: if the first call to this is with an app that has no translations all future call will get a list with only english in there - even if their l10n holds more translations --- lib/private/l10n.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/private/l10n.php b/lib/private/l10n.php index 168011cfcec..ad02ba88526 100644 --- a/lib/private/l10n.php +++ b/lib/private/l10n.php @@ -503,8 +503,9 @@ class OC_L10N implements \OCP\IL10N { * @return array an array of available languages */ public static function findAvailableLanguages($app=null) { - if(!empty(self::$availableLanguages)) { - return self::$availableLanguages; + // also works with null as key + if(isset(self::$availableLanguages[$app]) && !empty(self::$availableLanguages[$app])) { + return self::$availableLanguages[$app]; } $available=array('en');//english is always available $dir = self::findI18nDir($app); @@ -518,7 +519,7 @@ class OC_L10N implements \OCP\IL10N { } } - self::$availableLanguages = $available; + self::$availableLanguages[$app] = $available; return $available; } -- cgit v1.2.3