[TYPO3-dev] get language labels from random extension
Martin Kutschker
Martin.Kutschker at n0spam-blackbox.net
Tue Sep 11 13:35:59 CEST 2007
Steffen Kamper schrieb:
> "Dmitry Dulepov [typo3]" <dmitry at typo3.org> schrieb im Newsbeitrag
> news:mailman.1.1189508228.22615.typo3-dev at lists.netfielders.de...
>> Steffen Kamper wrote:
>>> i use a more simple way to do this:
>>>
>>> $dbLang_tmp=t3lib_div::readLLfile(t3lib_extMgm::extPath('extensionkey').'/pi1/locallang.xml',$GLOBALS['TSFE']->config['config']['language']);
>>> foreach($dbLang_tmp[$lkey] as $key=>$val) {
>>> $v[$key]=utf8_encode($val);
>>> }
>> ...which will fail if we implement language overlays finally...
>>
>
> sure, but should help for the moment. With overlay the readLLfile should be
> improved too, so that this should work also.
There are more problems which Steffen doesn't see because he uses probably
German.
readLLfile() returns the string in the charset of the BE language. Which is
iso-8859-1 for German but not for other languages. So utf8_encode() may
fail. Use the arrays and functions of t3lib_cs to to convert to the correct
charset.
Note that $LANG->charset holds the current charset which ay or may not be
utf8 depending on forceCharset. So utf8-encoding will not be the right
thing for you depending on your site.
Masi
More information about the TYPO3-dev
mailing list