Qual: Better init of default lang
This commit is contained in:
parent
b61c576343
commit
ae322ba17f
@ -133,9 +133,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
||||
// Instantiate hooks of thirdparty module only if not already define
|
||||
$hookmanager->initHooks(array('mainloginpage'));
|
||||
|
||||
$langcode=(GETPOST('lang')?((is_object($langs)&&$langs->defaultlang)?$langs->defaultlang:'auto'):GETPOST('lang'));
|
||||
$langs->setDefaultLang($langcode);
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("other");
|
||||
$langs->load("help");
|
||||
|
||||
@ -388,13 +388,13 @@ if (! defined('NOLOGIN'))
|
||||
if ($dolibarr_main_authentication == 'forceuser' && ! empty($dolibarr_auto_user)) $goontestloop=true;
|
||||
if (GETPOST("username","alpha",2) || ! empty($_COOKIE['login_dolibarr']) || GETPOST('openid_mode','alpha',1)) $goontestloop=true;
|
||||
|
||||
$langcode=(GETPOST('lang')?((is_object($langs)&&$langs->defaultlang)?$langs->defaultlang:'auto'):GETPOST('lang'));
|
||||
if (! is_object($langs)) // This can occurs when calling page with NOREQUIRETRAN defined, however we need lang for error messages.
|
||||
if (! is_object($langs)) // This can occurs when calling page with NOREQUIRETRAN defined, however we need langs for error messages.
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
|
||||
$langs=new Translate("",$conf);
|
||||
$langcode=(GETPOST('lang')?GETPOST('lang','alpha',1):(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT));
|
||||
$langs->setDefaultLang($langcode);
|
||||
}
|
||||
$langs->setDefaultLang($langcode);
|
||||
|
||||
if ($test && $goontestloop)
|
||||
{
|
||||
@ -677,10 +677,10 @@ if (! defined('NOREQUIRETRAN'))
|
||||
}
|
||||
}
|
||||
}
|
||||
else // If language was forced on URL
|
||||
/* else // If language was forced on URL
|
||||
{
|
||||
$langs->setDefaultLang(GETPOST('lang','alpha',1));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
// Case forcing style from url
|
||||
|
||||
@ -201,10 +201,11 @@ if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC'))
|
||||
}
|
||||
|
||||
|
||||
// Set default language (must be after the setValues of $conf)
|
||||
// Set default language (must be after the setValues setting global $conf->global->MAIN_LANG_DEFAULT. Page main.inc.php will overwrite langs->defaultlang with user value later)
|
||||
if (! defined('NOREQUIRETRAN'))
|
||||
{
|
||||
$langs->setDefaultLang((! empty($conf->global->MAIN_LANG_DEFAULT)?$conf->global->MAIN_LANG_DEFAULT:''));
|
||||
$langcode=(GETPOST('lang')?GETPOST('lang','alpha',1):(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT));
|
||||
$langs->setDefaultLang($langcode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user