[TYPO3-dev] Getting text from locallang.xml but not in current language

Loek Hilgersom hilgersom at xs4all.nl
Tue Jun 30 14:30:37 CEST 2009


Hi Georg,

This works perfectly!
I took a bit of time because I ran into a small issue: dots ('.') inside $key 
must be translated to '-'

$LOCAL_LANG = t3lib_div::readLLfile('EXT:mm_forum/pi1/locallang.xml', $to_lang);
$template = isset($LOCAL_LANG[$to_lang]['ntfMailForum-text']) ?
	$LOCAL_LANG[$to_lang]['ntfMailForum-text'] :
	$LOCAL_LANG['default']['ntfMailForum-text'];
$subject = isset($LOCAL_LANG[$to_lang]['ntfMailForum-subject']) ?
	$LOCAL_LANG[$to_lang]['ntfMailForum-subject'] :
	$LOCAL_LANG['default']['ntfMailForum-subject'];

I also added a check to take 'default' when there is no text for the selected 
language.

Now mm_forum sends its notifications in the preferred language of the receiver 
instead of the language that the current visitor has selected to view the site in!

Thanks,
Loek



Georg Ringer wrote:
> Hi,
> 
> try
> $LOCAL_LANG = 
> t3lib_div::readLLfile('EXT:rggooglemapfe/pi1/locallang.xml','de');
> $LOCAL_LANG = $LOCAL_LANG[$L];
> 
> $label = $LOCAL_LANG[$key];
> 
> georg




More information about the TYPO3-dev mailing list