improved browser language detect, set user language on login
This commit is contained in:
parent
3ea145fae7
commit
3e6180183b
5 changed files with 65 additions and 19 deletions
16
index.php
16
index.php
|
|
@ -29,22 +29,8 @@ $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false
|
|||
|
||||
@include(".htconfig.php");
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the language setting directly from system variables, bypassing get_config()
|
||||
* as database may not yet be configured.
|
||||
*
|
||||
* If possible, we use the value from the browser.
|
||||
*
|
||||
*/
|
||||
|
||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
$langs = preg_split("/[,-]/",$_SERVER['HTTP_ACCEPT_LANGUAGE'],2);
|
||||
$lang = $langs[0];
|
||||
} else {
|
||||
$lang = ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en');
|
||||
}
|
||||
|
||||
$lang = get_language();
|
||||
|
||||
load_translation_table($lang);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue