From da48cc763775981904730c87ce0524c67cc611e0 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Fri, 17 Aug 2012 14:13:01 +0000 Subject: Fix language redirection (see bug 7091) - modify relocate() function in langs.inc.php - modify ChooseLocale class constructor in localeDetection.class.php - we currently use ll-cc language tag format (instead of ll-CC, which ChooseLocale strictly expects until now) --- localeDetection.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'localeDetection.class.php') diff --git a/localeDetection.class.php b/localeDetection.class.php index 40e9862e4..d1b20357d 100644 --- a/localeDetection.class.php +++ b/localeDetection.class.php @@ -25,9 +25,11 @@ class ChooseLocale public $mapLonglocales; - public function __construct($list=array('en-US')) + public function __construct($list=array('en-US'), $force_http_accept_language = null) { - $this -> HTTPAcceptLang = $_SERVER['HTTP_ACCEPT_LANGUAGE']; + $this -> HTTPAcceptLang = is_null($force_http_accept_language) ? + $_SERVER['HTTP_ACCEPT_LANGUAGE'] : + $force_http_accept_language; $this -> supportedLocales = array_unique($list); $this -> setDefaultLocale('en-US'); $this -> setCompatibleLocale(); @@ -39,7 +41,7 @@ class ChooseLocale { if (empty($this->HTTPAcceptLang)) return null; - return explode(',', $this->HTTPAcceptLang); + return explode(',', strtolower($this->HTTPAcceptLang)); } public function getCompatibleLocale() -- cgit v1.2.1