From c80df96eca8282212a6867c59aff6ed6a0e800cc Mon Sep 17 00:00:00 2001 From: Lars Kneschke Date: Thu, 18 Sep 2003 05:04:06 +0000 Subject: [PATCH] detect users first language --- login.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/login.php b/login.php index ba60cbfb11..6b6444fbfd 100755 --- a/login.php +++ b/login.php @@ -266,9 +266,12 @@ } else { - // If the lastloginid cookies isn't set, we will default to english. - // Change this if you need. - $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = 'en'; + // If the lastloginid cookies isn't set, we will default to the first language, + // the users browser accepts. + list($lang) = explode(',',$_SERVER["HTTP_ACCEPT_LANGUAGE"]); + $lang = substr($lang,0,2); + if(strlen($lang) != 2) $lang="en"; + $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $lang; } $GLOBALS['phpgw']->translation->add_app('login'); $GLOBALS['phpgw']->translation->add_app('loginscreen');