autoload app's js translations

This commit is contained in:
Bernhard Posselt 2015-01-14 13:34:52 +01:00
parent f846d1e3f1
commit 717e3acd9b
1 changed files with 7 additions and 0 deletions

View File

@ -10,6 +10,7 @@ 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
@ -362,6 +363,12 @@ 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
// script is loaded.
if (!in_array($application, self::$loadedScriptTranslations)) {
self::addTranslations($application);
self::$loadedScriptTranslations[] = $application;
}
self::$scripts[] = $path; self::$scripts[] = $path;
} }
} }