mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2025-05-23 17:52:26 -04:00
Make locale negotiator respect HTTP Accept-Language format
This commit is contained in:
parent
7f8c2408ca
commit
3980f5daa6
@ -253,7 +253,8 @@ class LocaleNegotiator
|
|||||||
$langs = [];
|
$langs = [];
|
||||||
|
|
||||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||||
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);
|
$http_accept_language = str_replace("-", "_", $_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||||
|
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $http_accept_language, $lang_parse);
|
||||||
|
|
||||||
if (count($lang_parse[1])) {
|
if (count($lang_parse[1])) {
|
||||||
$langs = array_combine($lang_parse[1], $lang_parse[4]);
|
$langs = array_combine($lang_parse[1], $lang_parse[4]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user