ENHANCEMENT you can now choose your site locale at install time (from r100769)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/trunk@112201 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
sminnee 2010-10-13 04:24:26 +00:00
parent 454d58a04d
commit 7a3be4418e

View File

@ -50,9 +50,24 @@ if($envFileExists) {
}
}
include_once('sapphire/core/Object.php');
include_once('sapphire/core/i18n.php');
include_once('sapphire/dev/install/DatabaseConfigurationHelper.php');
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'])) {
foreach($locales as $code => $details) {
$bits = explode('_', $code);
if (preg_match("/{$bits[0]}.{$bits[1]}/", $_SERVER['HTTP_USER_AGENT'])) {
$defaultLocale = $code;
break;
}
}
}
// Register the SilverStripe provided databases
DatabaseAdapterRegistry::register(
'MySQLDatabase',
@ -832,6 +847,7 @@ class Installer extends InstallRequirements {
fclose($fh);
}
$theme = isset($_POST['template']) ? $_POST['template'] : 'blackcandy';
$locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US';
// Write the config file
global $usingEnv;
if($usingEnv) {
@ -853,6 +869,9 @@ MySQLDatabase::set_connection_charset('utf8');
// downloaded from http://www.silverstripe.org/themes/
SSViewer::set_theme('$theme');
// Set the site locale
i18n::set_locale($locale);
// enable nested URLs for this site (e.g. page/sub-page/)
SiteTree::enable_nested_urls();
PHP
@ -892,6 +911,9 @@ MySQLDatabase::set_connection_charset('utf8');
// downloaded from http://www.silverstripe.org/themes/
SSViewer::set_theme('$theme');
// Set the site locale
i18n::set_locale('$locale');
// enable nested URLs for this site (e.g. page/sub-page/)
SiteTree::enable_nested_urls();
PHP