Add other unit tests and fix a bug which caused COPS to be in english on a french IE11
This commit is contained in:
parent
a3ab0cc37c
commit
c5c9ffc3b0
2 changed files with 12 additions and 3 deletions
7
base.php
7
base.php
|
@ -197,7 +197,12 @@ function getAcceptLanguages() {
|
|||
|
||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
// break up string into pieces (languages and q factors)
|
||||
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
|
||||
$accept = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
||||
if (preg_match('/^(\w{2})-\w{2}$/', $accept, $matches)) {
|
||||
// Special fix for IE11 which send fr-FR and nothing else
|
||||
$accept = $accept . "," . $matches[1] . ";q=0.8";
|
||||
}
|
||||
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $accept, $lang_parse);
|
||||
|
||||
if (count($lang_parse[1])) {
|
||||
$langs = array();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue