fix for Stylite Ticket#8044 -Message on loginscreen and home doesent have a default lang fallback as all other egroupware translations

This commit is contained in:
Klaus Leithoff 2010-10-05 08:30:50 +00:00
parent 12cb6439ba
commit ea97a9671b
3 changed files with 24 additions and 10 deletions

View File

@ -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 '<div style="text-align: center;">' . lang('mainscreen_message') . "</div>\n";
echo '<div style="text-align: center;">' . $greeting . "</div>\n";
}
/*

View File

@ -393,18 +393,19 @@ else
$GLOBALS['egw_info']['user']['preferences']['common']['lang'] = $lang;
}
#print 'LANG:' . $GLOBALS['egw_info']['user']['preferences']['common']['lang'] . '<br>';
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']);
}
}

View File

@ -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);
}
}
}
/**