diff --git a/lib/exe/js.php b/lib/exe/js.php index e850218cf522d95e4f1e804ce9d7b632ce3fd37f..0582ddfcc8288c149f83a5b14f2bb138f7d25aea 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -219,18 +219,33 @@ function js_pluginscripts(){ * @return array */ function js_pluginstrings() { - global $conf; + global $conf, $config_cascade; $pluginstrings = array(); $plugins = plugin_list(); - foreach ($plugins as $p){ - if (isset($lang)) unset($lang); - if (file_exists(DOKU_PLUGIN."$p/lang/en/lang.php")) { - include DOKU_PLUGIN."$p/lang/en/lang.php"; + foreach($plugins as $p) { + $path = DOKU_PLUGIN . $p . '/lang/'; + + if(isset($lang)) unset($lang); + if(file_exists($path . "en/lang.php")) { + include $path . "en/lang.php"; + } + foreach($config_cascade['lang']['plugin'] as $config_file) { + if(file_exists($config_file . $p . '/en/lang.php')) { + include($config_file . $p . '/en/lang.php'); + } } - if (isset($conf['lang']) && $conf['lang']!='en' && file_exists(DOKU_PLUGIN."$p/lang/".$conf['lang']."/lang.php")) { - include DOKU_PLUGIN."$p/lang/".$conf['lang']."/lang.php"; + if(isset($conf['lang']) && $conf['lang'] != 'en') { + if(file_exists($path . $conf['lang'] . "/lang.php")) { + include($path . $conf['lang'] . '/lang.php'); + } + foreach($config_cascade['lang']['plugin'] as $config_file) { + if(file_exists($config_file . $p . '/' . $conf['lang'] . '/lang.php')) { + include($config_file . $p . '/' . $conf['lang'] . '/lang.php'); + } + } } - if (isset($lang['js'])) { + + if(isset($lang['js'])) { $pluginstrings[$p] = $lang['js']; } } @@ -247,15 +262,34 @@ function js_pluginstrings() { * @return array */ function js_templatestrings($tpl) { - global $conf; + global $conf, $config_cascade; + + $path = tpl_incdir() . 'lang/'; + $templatestrings = array(); - if (file_exists(tpl_incdir($tpl)."lang/en/lang.php")) { - include tpl_incdir($tpl)."lang/en/lang.php"; + if(file_exists($path . "en/lang.php")) { + include $path . "en/lang.php"; } - if (isset($conf['lang']) && $conf['lang']!='en' && file_exists(tpl_incdir($tpl)."lang/".$conf['lang']."/lang.php")) { - include tpl_incdir($tpl)."lang/".$conf['lang']."/lang.php"; + foreach($config_cascade['lang']['template'] as $config_file) { + if(file_exists($config_file . $conf['template'] . '/en/lang.php')) { + include($config_file . $conf['template'] . '/en/lang.php'); + } } - if (isset($lang['js'])) { + if(isset($conf['lang']) && $conf['lang'] != 'en' && file_exists($path . $conf['lang'] . "/lang.php")) { + include $path . $conf['lang'] . "/lang.php"; + } + if(isset($conf['lang']) && $conf['lang'] != 'en') { + if(file_exists($path . $conf['lang'] . "/lang.php")) { + include $path . $conf['lang'] . "/lang.php"; + } + foreach($config_cascade['lang']['template'] as $config_file) { + if(file_exists($config_file . $conf['template'] . '/' . $conf['lang'] . '/lang.php')) { + include($config_file . $conf['template'] . '/' . $conf['lang'] . '/lang.php'); + } + } + } + + if(isset($lang['js'])) { $templatestrings[$tpl] = $lang['js']; } return $templatestrings;