[TYPO3-english] Extbase: Multi-language problem

Felix Heller felix.heller at aimcom.de
Mon Aug 1 10:06:17 CEST 2011


I'm having some trouble with a multi-language extension which uses Extbase  
and Fluid. The problem is that it doesn't show entries in other languages  
than the default one (sys_language_uid = 0).

In the ext_tables.php, I've configured some tables like this one:

	$TCA['tx_example_domain_model_example'] = array(
		'ctrl' => array(
			// ...
			'languageField' => 'sys_language_uid',
			// ...

By activating the sqlDebug option in localconf.php, I was able to find a  
possible source for this problem. It is the SQL statement in the function  
addSysLanguageStatement($tableName, array &$sql) in  

	protected function addSysLanguageStatement($tableName, array &$sql) {
		if (is_array($GLOBALS['TCA'][$tableName]['ctrl'])) {
			if(isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField']) &&  
$GLOBALS['TCA'][$tableName]['ctrl']['languageField'] !== NULL) {
				$sql['additionalWhereClause'][] = $tableName . '.' .  
$GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . ' IN (0,-1)';

I think that this cannot work for entries in other languages than the  
default one because those entries have a sys_language_uid that is not 0 or  
-1. I solved this problem by modifying this row to:

	$sql['additionalWhereClause'][] = $tableName . '.' .  
$GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . ' IN ('.  
$GLOBALS['TSFE']->sys_language_uid .',-1)';

I have to implement this workaround for every new TYPO3 version which is  
quite nasty... I wonder if I've just misconfigured my extension somehow or  
if this is a problem with extbase. It would be nice if somebody could help  
me with issue.

Felix Heller

TYPO3-Agentur München
TYPO3 agency Munich

More information about the TYPO3-english mailing list