aboutsummaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/index.php b/index.php
index cc17119b6..ab722df2a 100644
--- a/index.php
+++ b/index.php
@@ -31,10 +31,17 @@ $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false
*
* 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);