From de23d55a8b954ae3e354b3a7a3dd06af7241787e Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 15 Jun 2009 04:34:03 +0000 Subject: [PATCH] BUGFIX Writing Locale in Translatable->onBeforeWrite() regardless of the record ID existing (see #4232). This is more in line with Translatable->requireDefaultRecords() which automatically updates all NULL locale values anyway. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79194 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/Translatable.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/model/Translatable.php b/core/model/Translatable.php index e90b687bd..1616793cd 100755 --- a/core/model/Translatable.php +++ b/core/model/Translatable.php @@ -672,8 +672,9 @@ class Translatable extends DataObjectDecorator { // If language is not set explicitly, set it to current_locale. // This might be a bit overzealous in assuming the language // of the content, as a "single language" website might be expanded - // later on. - if(!$this->owner->ID && !$this->owner->Locale) { + // later on. See {@link requireDefaultRecords()} for batch setting + // of empty Locale columns on each dev/build call. + if(!$this->owner->Locale) { $this->owner->Locale = Translatable::get_current_locale(); }