[TYPO3-mvc] Language overlay for table pages

Thomas Heilmann heilmann at mindscreen.de
Thu Nov 25 18:47:07 CET 2010


Hi Kevin,

> I now tried to translate the page objects while getting the translation from a new pageLanaguageOverlay with a custom query. This works fine. But my problem is that i have an object with the pages as children. I don't know how to "replace" the original page children with the translated ones before passing it to the view.

I have a similar problem at the moment: I want to get translated pages
via a page repository. I tried a similar approach like you via a
PageLanguageOverlayRepository -- unfortunately quite awkward,
translation handling should be done in the background. Anyway, after
getting the PageLanguageOverlays, I replace all properties of the Page
object that need to be translated:

$page->setTitle($pageLanguageOverlay->getTitle());
etc.

You cannot replace the whole object, because the Page object contains
more properties than the PageLanguageOverlay object.

> I'm not sure if my approach with an extra function to translate the objects is very good, maybe it would be better to do this within the repository.

In fact, I do the translation handling in the page repository. But in my
case pages are not child objects of another model, so I can put the
language overlay functionality in the findByXYZ method I need.

At the moment, I have no idea for a more elegant solution. If you find a
better way let us know! :)

Regards,
Thomas


More information about the TYPO3-project-typo3v4mvc mailing list