From ea97a9671befe770853af502287303e2d00095ea Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 5 Oct 2010 08:30:50 +0000 Subject: [PATCH] fix for Stylite Ticket#8044 -Message on loginscreen and home doesent have a default lang fallback as all other egroupware translations --- home/index.php | 9 ++++++--- login.php | 13 +++++++------ phpgwapi/inc/class.translation.inc.php | 12 +++++++++++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/home/index.php b/home/index.php index b2b0813362..104dd19188 100755 --- a/home/index.php +++ b/home/index.php @@ -78,13 +78,16 @@ ** Display the mainscreen message */ $GLOBALS['egw']->translation->add_app('mainscreen'); - if(translation::translate('mainscreen_message',false,'') == 'mainscreen_message') + $greeting = translation::translate('mainscreen_message',false,''); + + if($greeting == 'mainscreen_message'||empty($greeting)) { translation::add_app('mainscreen','en'); // trying the en one + $greeting = translation::translate('mainscreen_message',false,''); } - if(translation::translate('mainscreen_message',false,'') != 'mainscreen_message') + if(!($greeting == 'mainscreen_message'||empty($greeting))) { - echo '
' . lang('mainscreen_message') . "
\n"; + echo '
' . $greeting . "
\n"; } /* diff --git a/login.php b/login.php index 97a7aad5e2..eeb32e670e 100755 --- a/login.php +++ b/login.php @@ -393,18 +393,19 @@ else $GLOBALS['egw_info']['user']['preferences']['common']['lang'] = $lang; } #print 'LANG:' . $GLOBALS['egw_info']['user']['preferences']['common']['lang'] . '
'; - translation::init(); // this will set the language according to the (new) set prefs translation::add_app('login'); translation::add_app('loginscreen'); - if(translation::translate('loginscreen_message',false,'') == 'loginscreen_message') + $GLOBALS['loginscreenmessage'] = translation::translate('loginscreen_message',false,''); + if($GLOBALS['loginscreenmessage'] == 'loginscreen_message' || empty($GLOBALS['loginscreenmessage'])) { - translation::add_app('loginscreen','en'); // trying the en one + translation::add_app('loginscreen','en'); // trying the en one + $GLOBALS['loginscreenmessage'] = translation::translate('loginscreen_message',false,''); } - if(translation::translate('loginscreen_message',false,'') != 'loginscreen_message') + if($GLOBALS['loginscreenmessage'] == 'loginscreen_message' || empty($GLOBALS['loginscreenmessage'])) { - // for now store login message in globals so it is available for the login.inc.php - $GLOBALS['loginscreenmessage']=stripslashes(lang('loginscreen_message')); + // remove the global var since the lang loginscreen message and its fallback (en) is empty or not set + unset($GLOBALS['loginscreenmessage']); } } diff --git a/phpgwapi/inc/class.translation.inc.php b/phpgwapi/inc/class.translation.inc.php index 01c7cabdcb..e1a0a6e1f3 100644 --- a/phpgwapi/inc/class.translation.inc.php +++ b/phpgwapi/inc/class.translation.inc.php @@ -935,7 +935,17 @@ class translation ),__LINE__,__FILE__); // invalidate the cache - egw_cache::unsetCache(in_array($app,self::$instance_specific_translations) ? egw_cache::INSTANCE : egw_cache::TREE,__CLASS__,$app.':'.$lang); + if(!in_array($app,self::$instance_specific_translations)) + { + egw_cache::unsetCache(egw_cache::TREE,__CLASS__,$app.':'.$lang); + } + else + { + foreach((array)self::get_installed_langs() as $key => $name) + { + egw_cache::unsetCache(egw_cache::INSTANCE,__CLASS__,$app.':'.$key); + } + } } /**