Merge pull request #471 from solstag/master

Language selection: case-insensitive and system language
This commit is contained in:
RedMatrix 2014-05-24 08:51:50 +10:00
commit 47bd0b3211
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;

View File

@ -27,9 +27,6 @@ $a->install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? fal
@include(".htconfig.php");
$a->language = get_best_language();
/**
*
* Try to open the database;
@ -54,6 +51,7 @@ if(! $a->install) {
load_hooks();
call_hooks('init_1');
$a->language = get_best_language();
load_translation_table($a->language);
// Force the cookie to be secure (https only) if this site is SSL enabled. Must be done before session_start().
@ -69,6 +67,7 @@ if(! $a->install) {
}
else {
// load translations but do not check plugins as we have no database
$a->language = get_best_language();
load_translation_table($a->language,true);
}