BUGFIX: Set Member default Locale (from r100527)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@105595 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-05-25 04:15:13 +00:00
parent 4e87fb5713
commit b9e75f9cef

View File

@ -107,6 +107,15 @@ class Member extends DataObject {
*/
protected static $login_marker_cookie = null;
/**
* Ensure the locale is set to something sensible by default.
*/
public function populateDefaults() {
parent::populateDefaults();
$this->Locale = i18n::get_locale();
}
/**
* If this is called, then a session cookie will be set to "1" whenever a user
* logs in. This lets 3rd party tools, such as apache's mod_rewrite, detect
@ -469,8 +478,7 @@ class Member extends DataObject {
$fields->replaceField('Locale', new DropdownField (
'Locale',
$this->fieldLabel('Locale'),
i18n::get_existing_translations(),
(($this->Locale) ? $this->Locale : i18n::get_locale())
i18n::get_existing_translations()
));
$fields->removeByName('RememberLoginToken');
@ -1002,12 +1010,10 @@ class Member extends DataObject {
'Email'
);
$locale = ($this->Locale) ? $this->Locale : i18n::get_locale();
$mainFields->replaceField('Locale', new DropdownField(
"Locale",
_t('Member.INTERFACELANG', "Interface Language", PR_MEDIUM, 'Language of the CMS'),
i18n::get_existing_translations(),
$locale
i18n::get_existing_translations()
));
$mainFields->removeByName('Bounced');
@ -1689,5 +1695,6 @@ class Member_Validator extends RequiredFields {
return $js;
}
}
?>