Hey thanks a lot for this! Really appreciated I'll try and see if I can't fix some of it with my limited php skills haha.. Either way it's a step in the right direction and at least for now there seems to be a way of fixing it, so hopefully we can figure it all out and get the translations working with the modules =)
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
DataObjectManager Module /
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba
[ImageGallery] Translatable Problems
- Previous 10 entries
- 1
- 2
- 3
- Page 44(current)
- 5
- Next 10 entries
Hi xeal,
did some research on this but didn't come so far. have to stop now and want to share my results.
i tried to join the translation table but somehow an automagical "AND ImageGalleryPageID = ..." is added. Removing this manually and running the query in phpMyAdmin gets me the wanted results.
TableListField seems to add the additional where clause :(
Here is my (not yet working) code:
$translationGroupID = $this->getTranslationGroup();
$baseDataClass = ClassInfo::baseDataClass($this->class);
$join = sprintf('LEFT JOIN `%s_translationgroups` tg ON `tg`.`TranslationGroupID` = %d',
$baseDataClass,
$translationGroupID
);
$albumFilter = $this->albumClass . '.ImageGalleryPageID = tg.OriginalID';
$manager = new DataObjectManager(
$this,
'Albums',
$this->albumClass,
array('AlbumName' => _t('ImageGalleryAlbum.ALBUMNAME','Album Name'), 'Description' => _t('ImageGalleryAlbum.DESCRIPTION','Description')),
'getCMSFields_forPopup',
$albumFilter,
null,
$join
);
Reading in docs http://doc.silverstripe.com/doku.php?id=tablelistfield&s=customquery i think either $customQuery or maybe http://doc.silverstripe.com/doku.php?id=tablelistfield&s=customquery#source_input setCustomSourceItems() could be our friend. See LanguageSwitcherWidget how it retrieves the DataSet.
I'd go with customquery, which of course has to be included in Controller for frontend output, too.
hth for now
wmk
Hi wmk,
Thanks for the information it helped me work out a few things.
As of right now I can get all the albums in both the English and French translation.
The only problem is right now in the French version it sees the albums in the albums tab, but as soon as I switch to the photos tab it asks me to create an album to add photos. I'll post the code I have so far which is working, but as I explained not fully.
$translationGroupID = $this->getTranslationGroup();
$baseDataClass = ClassInfo::baseDataClass($this->class);
$resultSet = new DataObjectSet();
$filter = $this->albumClass . '.ImageGalleryPageID = tg.OriginalID';
$sort = "";
$join = sprintf('LEFT JOIN %s_translationgroups tg ON tg.TranslationGroupID = %d',
$baseDataClass,
$translationGroupID
);
$instance = singleton($this->albumClass);
$query = $instance->buildSQL($filter, $sort, null, $join);
$manager = new DataObjectManager (
$this,
'Albums',
$this->albumClass,
array(
'AlbumName' => _t('ImageGalleryAlbum.ALBUMNAME','Album Name'),
'Description' => _t('ImageGalleryAlbum.DESCRIPTION','Description')
),
'getCMSFields_forPopup',
"ImageGalleryPageID = {$this->ID}"
);
$manager->setCustomQuery($query);
I'm about to stop for the day and I figured I'd post what I found as you did, so anyone who wants to pick this up can be up to date with our changes.
Xeal
Sorry for digging up an old post.
I'd just like to thank wmk for the patch he provided to make the DOM work with translatable.
Seems like the translatable extension doesn't receive much attention from module developers (I admit, it's a rather complex subject).
I can understand the frustration of the OP perfectly, I too was frustrated when I built a site with UserForms and DOM and then the whole thing stopped working when translations were enabled. At least the DOM works, now I just need to find a solution to the userforms problem. I guess I'll end up building a static form...
Hi!
Any news on this? I´m having the exact same problem as Edu115! My clients project is also halted due to this issue..
Banal seems to think that wmk submitted a working patch. Is that true?
Yeah, but didn´t he write that it wasn´t working yet. I´m not a programmer and would need a working code to use! :)
I successfully patched the DataObjectManager to work with Translatable. I don't think that it will work with the ImageGallery Module though.
Actually it is a set of patches that have to be applied. Some of them are provided by the SilverStripe devs (patches to ComplexTableField) and then on top of that, one has to apply the DOM patch by wmk.
I'm assuming that the ComplexTableField patches are in SilverStripe trunk, so getting the code from there should work. Then the only thing that needs to be patched is the DataObjectManager, unless UncleCheese has merged the wmk patch back into his code?
- Previous 10 entries
- 1
- 2
- 3
- Page 44(current)
- 5
- Next 10 entries