mirror of
https://github.com/friendica/friendica
synced 2024-12-22 17:20:16 +00:00
Autodetect browser language (should we make this optional?)
This commit is contained in:
parent
25c674b73a
commit
8520917571
1 changed files with 8 additions and 1 deletions
|
@ -31,10 +31,17 @@ $install = ((file_exists('.htconfig.php')) ? false : true);
|
|||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
$lang = ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en');
|
||||
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');
|
||||
}
|
||||
|
||||
load_translation_table($lang);
|
||||
|
||||
|
|
Loading…
Reference in a new issue