Monthly Archives: Dezember 2007

Typo3 Localize your own extensions

When you try to write your own front end (FE) extensions with Typo3 there are common pitfalls. First of all be sure you enabled your table to hold the information. (Can be done very easy via the kickstarter). Next be sure you don’t query do much information of your table. All you need are the row where „sys_language_uid=0″. Your translation is made via the getRecordOverlay ! This short code snippet may help you to resolve your problems:

[sourcecode lang=“php“]
function readDBData( $table, $where )
{
$back = array();

if ( $where!=““ )
$where.= “ AND „;
$where .= “ deleted=0 AND hidden = 0 AND sys_language_uid=0″;

$res = $GLOBALS[‚TYPO3_DB‘]->exec_SELECTquery( ‚*‘, $table, $where );
while ($row = $GLOBALS[‚TYPO3_DB‘]->sql_fetch_assoc($res))
{
if ($GLOBALS[‚TSFE‘]->sys_language_content)
{
$OLmode = ($this->sys_language_mode == ’strict‘?’hideNonTranslated‘:“);
$row = $GLOBALS[‚TSFE‘]->sys_page->getRecordOverlay( $table, $row, $GLOBALS[‚TSFE‘]->sys_language_content, $OLmode);
}
$back[] = $row;
}

return $back;
}
[/sourcecode]

PS: Keep in mind this tip, too: Web List: ‚Localize-to-feature‘