mirror of
https://github.com/silverstripe/silverstripe-installer
synced 2024-10-22 17:05:33 +02:00
ENHANCEMENT you can now choose your site locale at install time
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/branches/2.4@100769 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
ff70fca745
commit
625de452f7
22
install.php
22
install.php
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user