[TYPO3-mvc] problem with the output of limited multilingual domain objects

Felix Nagel lists at felixnagel.com
Wed Nov 23 14:43:32 CET 2011


Am 18.11.2011 15:27, schrieb Kerstin Eitner:
 > does really no one discover the same problem with multilingual domain
 > objects? e.g. in the news extension?
 > Or knows an workaround how to handle that?
Im able to reproduce this problem in news and opened an issue for that, 
see: http://forge.typo3.org/issues/32020
Currently there is no workaround for that afaik.


Am 18.11.2011 15:49, schrieb Tim Schoch | GSTALTIG:
> IIRC this is a general problem with language overlay and not directly related to extbase.
> The limit is applied to the default language and, after those records are fetched, the overlaying is processed.
> If now one record is not translated it gets discarded and you end up with a single record instead of the two you set the limit for.
Correct, this is a general extbase problem.
I would like to extend the problem to the use case when a localized 
records should be added without having a default record.

In "the old days" I would fix both problems (same amount of localized 
records and localized record without default one) like this:

<?php
// we need at last uid, pid, sys_language_uid
$select = 'uid, pid, sys_language_uid, text, title'
$table = 'tx_myext_data';
// we try to get the default language entry (normal behaviour) or, if 
not possible, currently the needed language (fallback if no default 
language entry is available)
$where = '(sys_language_uid IN (-1,0) OR (sys_language_uid = ' 
.$GLOBALS['TSFE']->sys_language_uid. ' AND l18n_parent = 0))';
$where  .= $GLOBALS['TSFE']->sys_page->enableFields($table);
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where, 
'', '', '');

while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
   // check for language overlay if:
   // * row is valid
   // * row language is different from currently needed language
   // * sys_language_contentOL is set
   if (is_array($row) && $row['sys_language_uid'] != 
$GLOBALS['TSFE']->sys_language_content && 
$GLOBALS['TSFE']->sys_language_contentOL) {
     $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($table, 
$row,$GLOBALS['TSFE']->sys_language_content, 
$GLOBALS['TSFE']->sys_language_contentOL);
   }
}
?>

Please see comments for explaination or take a look at my blog to get a 
better description of this problem (German language): 
http://www.felixnagel.com/blog/artikel/2010/06/24/mehrsprachige-typo3-extensions-getrecordoverlay-richtig-einsetzen/

I think something similar should be done in extbase, too. Please note 
this idea has a problem left: if the default records is hidden no 
localized records are found.

Any comments?	

-- 
Regards
Felix Nagel


More information about the TYPO3-project-typo3v4mvc mailing list