MINOR Installer gets default locale from i18n::get_locale() before trying to autodiscover by USER_AGENT string (from r100877)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/trunk@112206 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
sminnee 2010-10-13 04:25:07 +00:00
parent b9bf36c35b
commit 21b75a3d6e

View File

@ -57,11 +57,11 @@ include_once('sapphire/dev/install/DatabaseAdapterRegistry.php');
// Set default locale, but try and sniff from the user agent
$locales = i18n::$common_locales;
$defaultLocale = 'en_US';
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$defaultLocale = i18n::get_locale();
if(isset($_SERVER['HTTP_USER_AGENT'])) {
foreach($locales as $code => $details) {
$bits = explode('_', $code);
if (preg_match("/{$bits[0]}.{$bits[1]}/", $_SERVER['HTTP_USER_AGENT'])) {
if(preg_match("/{$bits[0]}.{$bits[1]}/", $_SERVER['HTTP_USER_AGENT'])) {
$defaultLocale = $code;
break;
}