[TYPO3-dev] includeLLFile() - force language

Bernd Wilke xoonsji02 at sneakemail.com
Mon Sep 17 16:43:56 CEST 2007


Brian Bendtsen schrieb:
> Hi
> 
> Im using the function includeLLFile() in an extension like so:
> 
> $LANG = t3lib_div::makeInstance('language');
> $LANG->includeLLFile('EXT:indmeldelse/locallang_db.xml');
> 
> loop begin
> $LANG->getLL('tx_indmeldelse_medlem.'.$name)
> loop end
> 
> and the labels are found but not in the right language.
> 
> My language is set to danish but the english labels are used. Can I tell 
> this function to use the danish language?
> 
> /Brian Bendtsen

just have a look into the source of pi_getLL() 
(typo3/sysext/cms/tslib/class.tslib_pibase.php line 942):

if (isset($this->LOCAL_LANG[$this->LLkey][$key]))	{
	$word = 
$GLOBALS['TSFE']->csConv($this->LOCAL_LANG[$this->LLkey][$key], 
$this->LOCAL_LANG_charset[$this->LLkey][$key]);	
} else ....

the actual language is decided by $this->LLkey.
if you want to get the words from another than the actual language you 
have to save this value and change it to your desired value.
Then you can access the desired language with the default-function.
after the work is done, don't forget to restore the original language-value!

Bernd

-- 
http://www.pi-phi.de/t3v4/cheatsheet.html




More information about the TYPO3-dev mailing list