fixed under some conditions not working translations, caused by egw object calling translation::init and preceeding lang_arr with (en) translations, before lang.php calls add_app() with a single translation, now explicitly calling init() and init() allways empties lang_arr

This commit is contained in:
Ralf Becker 2014-06-12 10:07:57 +00:00
parent 288f46aafd
commit 95b89a0c9f
2 changed files with 4 additions and 1 deletions

View File

@ -192,9 +192,10 @@ class translation
//error_log(__METHOD__."() load_via set from config to ".array2string(self::$load_via)); //error_log(__METHOD__."() load_via set from config to ".array2string(self::$load_via));
} }
self::$lang_arr = self::$loaded_apps = array();
if ($load_translations) if ($load_translations)
{ {
self::$lang_arr = self::$loaded_apps = array();
if ($GLOBALS['egw_info']['user']['preferences']['common']['lang']) if ($GLOBALS['egw_info']['user']['preferences']['common']['lang'])
{ {
self::$userlang = $GLOBALS['egw_info']['user']['preferences']['common']['lang']; self::$userlang = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];
@ -275,6 +276,7 @@ class translation
*/ */
static function add_app($apps, $lang=null) static function add_app($apps, $lang=null)
{ {
//error_log(__METHOD__."(".array2string($apps).", $lang) count(self::\$lang_arr)=".count(self::$lang_arr));
//$start = microtime(true); //$start = microtime(true);
if (!$lang) $lang = self::$userlang; if (!$lang) $lang = self::$userlang;
$tree_level = $instance_level = array(); $tree_level = $instance_level = array();

View File

@ -51,6 +51,7 @@ if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $
common::egw_exit(); common::egw_exit();
} }
translation::init(false);
translation::add_app($_GET['app'], $_GET['lang']); translation::add_app($_GET['app'], $_GET['lang']);
if (!count(translation::$lang_arr)) if (!count(translation::$lang_arr))
{ {