[TYPO3-dev] get language labels from random extension
Steffen Kamper
steffen at sk-typo3.de
Tue Sep 11 14:53:19 CEST 2007
"Martin Kutschker" <Martin.Kutschker at n0spam-blackbox.net> schrieb im
Newsbeitrag
news:mailman.1.1189510558.14767.typo3-dev at lists.netfielders.de...
> 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
Hi Masi,
we're talking from FE-extension, or not?
Anyway the readLLfile (using readLLXMLfile) take care ot that.
utf8_encode() is wrong at this place, i had to use because of serverproblems
in this case.
readLLXMLfile uses the $GLOBALS['LANG']->csConvObj (for BE) or
$GLOBALS['TSFE']->csConvObj (for FE)
so character encoding should work without problems.
vg Steffen
More information about the TYPO3-dev
mailing list