aboutsummaryrefslogtreecommitdiffstats
path: root/localeDetection.class.php
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2012-08-17 14:13:01 +0000
committerRomain d'Alverny <rda@mageia.org>2012-08-17 14:13:01 +0000
commitda48cc763775981904730c87ce0524c67cc611e0 (patch)
treeea8ae692f3f97ca04acd3d33f9882e506e59cd99 /localeDetection.class.php
parent399b91bbca4997fbbbf36a06649be15dd53fd2c2 (diff)
downloadwww-da48cc763775981904730c87ce0524c67cc611e0.tar
www-da48cc763775981904730c87ce0524c67cc611e0.tar.gz
www-da48cc763775981904730c87ce0524c67cc611e0.tar.bz2
www-da48cc763775981904730c87ce0524c67cc611e0.tar.xz
www-da48cc763775981904730c87ce0524c67cc611e0.zip
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)
Diffstat (limited to 'localeDetection.class.php')
-rw-r--r--localeDetection.class.php8
1 files changed, 5 insertions, 3 deletions
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()