diff --git a/library/includes/sessions.php b/library/includes/sessions.php index eaa01c67..822fa80e 100644 --- a/library/includes/sessions.php +++ b/library/includes/sessions.php @@ -568,7 +568,7 @@ class user_common */ function init_userprefs () { - global $bb_cfg, $theme, $lang, $DeltaTime; + global $bb_cfg, $theme, $source_lang, $DeltaTime; if (defined('LANG_DIR')) return; // prevent multiple calling @@ -594,8 +594,17 @@ class user_common if (!defined('LANG_DIR')) define('LANG_DIR', DEFAULT_LANG_DIR); + /** Temporary place source language to the global */ + $lang = array(); + require(ENGLISH_LANG_DIR .'main.php'); + $source_lang = $lang; + unset($lang); + + /** Place user language to the global */ + global $lang; require(LANG_DIR .'main.php'); setlocale(LC_ALL, isset($bb_cfg['lang'][$this->data['user_lang']]['locale']) ? $bb_cfg['lang'][$this->data['user_lang']]['locale'] : 'en_US.UTF-8'); + $lang += $source_lang; $theme = setup_style(); $DeltaTime = new Date_Delta(); diff --git a/library/includes/template.php b/library/includes/template.php index 39e67ca2..4c5e7253 100644 --- a/library/includes/template.php +++ b/library/includes/template.php @@ -245,10 +245,11 @@ class Template { $this->cur_tpl = $filename; - global $lang, $bb_cfg, $user, $tr_cfg; + global $lang, $source_lang, $bb_cfg, $user, $tr_cfg; $L =& $lang; $V =& $this->vars; + $SL =& $source_lang; if ($filename) { @@ -931,7 +932,7 @@ class Template $code = str_replace($search, $replace, $code); } // This will handle the remaining root-level varrefs - $code = preg_replace('#\{(L_([a-z0-9\-_]+?))\}#i', '', $code); + $code = preg_replace('#\{(L_([a-z0-9\-_]+?))\}#i', '', $code); $code = preg_replace('#\{(\$[a-z_][a-z0-9_$\->\'\"\.\[\]]*?)\}#i', '', $code); $code = preg_replace('#\{(\#([a-z_][a-z0-9_]*?))\}#i', '', $code); $code = preg_replace('#\{([a-z0-9\-_]+?)\}#i', '', $code);