Skip to content
Snippets Groups Projects
Commit acd3eb67 authored by Klap-in's avatar Klap-in
Browse files

Enable LANG.template.<template>.key to provide localized strings in templates

parent e8ec13b9
No related branches found
No related tags found
No related merge requests found
...@@ -96,6 +96,10 @@ function js_out(){ ...@@ -96,6 +96,10 @@ function js_out(){
// load JS specific translations // load JS specific translations
$json = new JSON(); $json = new JSON();
$lang['js']['plugins'] = js_pluginstrings(); $lang['js']['plugins'] = js_pluginstrings();
$templatestrings = js_templatestrings();
if(!empty($templatestrings)) {
$lang['js']['template'] = $templatestrings;
}
echo 'LANG = '.$json->encode($lang['js']).";\n"; echo 'LANG = '.$json->encode($lang['js']).";\n";
// load toolbar // load toolbar
...@@ -210,6 +214,21 @@ function js_pluginstrings() ...@@ -210,6 +214,21 @@ function js_pluginstrings()
return $pluginstrings; return $pluginstrings;
} }
function js_templatestrings() {
global $conf;
$templatestrings = array();
if (@file_exists(tpl_incdir()."lang/en/lang.php")) {
include tpl_incdir()."lang/en/lang.php";
}
if (isset($conf['lang']) && $conf['lang']!='en' && @file_exists(tpl_incdir()."lang/".$conf['lang']."/lang.php")) {
include tpl_incdir()."lang/".$conf['lang']."/lang.php";
}
if (isset($lang['js'])) {
$templatestrings[$conf['template']] = $lang['js'];
}
return $templatestrings;
}
/** /**
* Escapes a String to be embedded in a JavaScript call, keeps \n * Escapes a String to be embedded in a JavaScript call, keeps \n
* as newline * as newline
......
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