Language selection: case-insensitive and system language

Fixed ignoring HTTP_ACCEPT_LANGUAGE tags that had uppercase
characters.

Fixed defining a->language too soon to ever get the system lang
This commit is contained in:
Alexandre Hannud Abdo
2014-05-23 10:16:03 -03:00
parent 691801120d
commit bc389ff934
2 changed files with 3 additions and 5 deletions

View File

@@ -43,8 +43,6 @@ function get_browser_language() {
arsort($langs, SORT_NUMERIC);
}
}
else
$langs['en'] = 1;
return $langs;
}
@@ -65,6 +63,7 @@ function get_best_language() {
if(isset($langs) && count($langs)) {
foreach ($langs as $lang => $v) {
$lang = strtolower($lang);
if(file_exists("view/$lang") && is_dir("view/$lang")) {
$preferred = $lang;
break;