aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorolivierm <olivier@migeot.org>2011-03-08 14:41:04 +0100
committerolivierm <olivier@migeot.org>2011-03-08 14:41:04 +0100
commit852091757166ffe0115ceade5af10154a2485286 (patch)
tree9b0dcbb921db24b75990b6594b28bc3e4e79773a
parent25c674b73a5ec39a9826906aed3e35e77d72e392 (diff)
downloadvolse-hubzilla-852091757166ffe0115ceade5af10154a2485286.tar.gz
volse-hubzilla-852091757166ffe0115ceade5af10154a2485286.tar.bz2
volse-hubzilla-852091757166ffe0115ceade5af10154a2485286.zip
Autodetect browser language (should we make this optional?)
-rw-r--r--index.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/index.php b/index.php
index bbd2c81cd..24466a85a 100644
--- a/index.php
+++ b/index.php
@@ -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);