Simplify language detection
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@964 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
ac1d7bd44e
commit
b8cf0e78b0
|
@ -51,9 +51,9 @@ if (isset($langs[$_COOKIE["adminer_lang"]])) {
|
|||
$LANG = $_SESSION["lang"];
|
||||
} else {
|
||||
$accept_language = array();
|
||||
preg_match_all('~([-a-z_]+)(;q=([0-9.]+))?~', strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"]), $matches, PREG_SET_ORDER);
|
||||
preg_match_all('~([-a-z]+)(;q=([0-9.]+))?~', str_replace("_", "-", strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"])), $matches, PREG_SET_ORDER);
|
||||
foreach ($matches as $match) {
|
||||
$accept_language[str_replace("_", "-", $match[1])] = (isset($match[3]) ? $match[3] : 1);
|
||||
$accept_language[$match[1]] = (isset($match[3]) ? $match[3] : 1);
|
||||
}
|
||||
arsort($accept_language);
|
||||
foreach ($accept_language as $key => $q) {
|
||||
|
|
Loading…
Reference in a new issue