summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlap-in <klapinklapin@gmail.com>2013-08-02 13:41:42 +0200
committerKlap-in <klapinklapin@gmail.com>2013-08-02 13:41:42 +0200
commitacd3eb673b5f7c26fc8ec53d0147b30769e2a866 (patch)
tree0b25ae44158c3f7c7ffa907136405b011da57499
parente8ec13b9a448dc4c0be4aa459d1586165aed6044 (diff)
downloadrpg-acd3eb673b5f7c26fc8ec53d0147b30769e2a866.tar.gz
rpg-acd3eb673b5f7c26fc8ec53d0147b30769e2a866.tar.bz2
Enable LANG.template.<template>.key to provide localized strings in templates
-rw-r--r--lib/exe/js.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/exe/js.php b/lib/exe/js.php
index 06769d895..4b4b598de 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -96,6 +96,10 @@ function js_out(){
// load JS specific translations
$json = new JSON();
$lang['js']['plugins'] = js_pluginstrings();
+ $templatestrings = js_templatestrings();
+ if(!empty($templatestrings)) {
+ $lang['js']['template'] = $templatestrings;
+ }
echo 'LANG = '.$json->encode($lang['js']).";\n";
// load toolbar
@@ -210,6 +214,21 @@ function js_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
* as newline