move check into addTranslation method

This commit is contained in:
Bernhard Posselt 2015-01-14 14:57:56 +01:00
parent 1cce1f0e6b
commit 4ec4914bb4
1 changed files with 1 additions and 11 deletions

View File

@ -10,7 +10,6 @@ class OC_Util {
public static $headers = array(); public static $headers = array();
private static $rootMounted = false; private static $rootMounted = false;
private static $fsSetup = false; private static $fsSetup = false;
private static $loadedScriptTranslations = array();
private static function initLocalStorageRootFS() { private static function initLocalStorageRootFS() {
// mount local file backend as root // mount local file backend as root
@ -363,14 +362,7 @@ class OC_Util {
public static function addScript($application, $file = null) { public static function addScript($application, $file = null) {
$path = OC_Util::generatePath($application, 'js', $file); $path = OC_Util::generatePath($application, 'js', $file);
if (!in_array($path, self::$scripts)) { if (!in_array($path, self::$scripts)) {
// load javascript translations if it is the first time an app's self::addTranslations($application);
// script is loaded.
if (!isset(self::$loadedScriptTranslations[$application]) && $file && $application !== 'core') {
error_log("adding " . $application . " " . $file);
self::addTranslations($application);
self::$loadedScriptTranslations[$application] = true;
}
self::$scripts[] = $path; self::$scripts[] = $path;
} }
} }
@ -406,9 +398,7 @@ class OC_Util {
$path = "l10n/$languageCode"; $path = "l10n/$languageCode";
} }
if (!in_array($path, self::$scripts)) { if (!in_array($path, self::$scripts)) {
error_log("translation " . $path);
self::$scripts[] = $path; self::$scripts[] = $path;
error_log(print_r(self::$scripts, true));
} }
} }