3066 Posts in 866 Topics by 648 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1160 Views |
-
Odd Translatable behavior

13 February 2010 at 8:25am
Hi Everyone,
I have the following code in my _config file to make sitetree and dataobjects translatable:Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('DOStaffMember', 'Translatable'); //DataobjectObject::add_extension('DOEvent', 'Translatable'); //Dataobject
Object::add_extension('DOAudioVideoFile', 'Translatable'); //Dataobject
Object::add_extension('DOFolder', 'Translatable'); //DataobjectObject::add_extension('DOPatent', 'Translatable'); //Dataobject
Object::add_extension('DOFrequentlyAskedQuestion', 'Translatable'); //Dataobject//Restrict all locales to this list:
Translatable::set_allowed_locales(array(
'en_US',
'de_DE',
'ja_JP'
)
);The problem that I am getting is that a 'Locale' column appears on my sitetree table (which is normal), but also on tables that have extended the Page class, like Homepage and Blog.
this is messing up some things like Blog archive where it uses a Natural Join in a DB::query() call. (the join finds 2 locale tables and returns nothing)
does anyone have any thoughts why these extra columns are being created? The site is using SS 2.3.3 or 2.3.4 (yes, i need to upgrade). I tried only decorating sitetree with Translatable, and removed the Decorators from the DataObjects, deleted the Locale tables from Homepage, but they are added once i do another dev/build/.
I'd love to hear any suggestions.
thanks,
-Chris -
Re: Odd Translatable behavior

16 February 2010 at 4:32am
I found out that a dataobjectdecorator that i am using on BlogEntry is causing the problem. something tells me that this is a bug between dataobjectdecorator and the Translatable extension. adding this decorator with this code causes the problems:
// BlogEntryDecorator.php
<?phpclass BlogEntryDecorator extends DataObjectDecorator {
function extraStatics() {
return array(
'db' => array(
'PodcastContent' => 'HTMLText',
)
);
}
public function updateCMSFields(FieldSet &$fields) {
$fields->addFieldToTab('Root.Content.EmbedCode', new TextAreaField('PodcastContent', 'Embed Code'));
}
}
?>//mysite/_config.php
<?php
//...
DataObject::add_extension('BlogEntry', 'BlogEntryDecorator');
//... -
Re: Odd Translatable behavior

21 February 2010 at 7:33pm
I've just tried your BlogEntryDecorator with the newest 2.3 and blog 0.2.1 - works as expected here, no duplicated Locale columns in the BlogEntry table. Sure you haven't added Translatable to BlogEntry at some point? Keep in mind that these columns won't be deleted automatically. Can you reproduce the problem on a fresh database?
-
Re: Odd Translatable behavior

23 February 2010 at 4:19am
Hi Ingo,
Thanks for looking into this. i upgraded the site to 2.3.6 (was running 2.3.3) and deleted the locale columns from appropriate tables and everything works fine now. the reason why i hadnt upgraded the site to 2.3.6 was because i had to apply a patch #4199 to make CTF's work in all locales. i know that you want to avoid session variables in the solution, and i'm curious if you have a recommended solution to fix that problem. it just makes upgrading a little harder on a multi-lingual website.thanks again for looking into this! I really appreciate the help!
-Chris
| 1160 Views | ||
|
Page:
1
|
Go to Top |


