[TYPO3-core] RFC: #9346: Preinitialise GLOBALS[LANG] in init.php

Martin Kutschker masi-no at spam-typo3.org
Wed Sep 17 09:21:29 CEST 2008


Franz Holzinger schrieb:
> Martin Kutschker a écrit :
>> Franz Holzinger schrieb:
>>> Hello Steffen,
>>>
>>>> I moved initialisation to init.php direct after BE_USER authentication
>>>> and removed the other initialisations.
>>>>
>>>> Now we have GLOBALS[LANG] available all the time (in BE)
>>>> (because it isn't i declared the patch as bugfix)
>>> Move the lines
>>> +require_once(PATH_typo3.'sysext/lang/lang.php');
>>> +$GLOBALS['LANG'] = t3lib_div::makeInstance('language');
>>> +$GLOBALS['LANG']->init($BE_USER->uc['lang']);
>>>
>>> to the beginning of the file init.php.
>>> So the global language would be available everywhere for the future.
>>> At the moment the class library t3lib_div contains many error texts only
>>> in English. It would be fine to have them one day replaced by texts in
>>> multiple languages. But then no t3lib_div::makeInstance could be used,
>>> but the new operator. The init method might be called even later.
>>
>> All messages of t3lib_div are developer orientated. The calling code
>> should handle errors and return appropriate messages to the end user.
>>
>> Therefore I don't think that t3lib_div should require $LANG.
> 
> Even the error messages coming from low level t3lib_div functions should
> be prepared for an output as an error detail for the frontend or into a
> log file. You should not force TYPO3 users to know English.

IHMO t3lib_div should not output any messages at all. It's lowlevel
code. All it shoudl do is throw errors or return result codes.

Masi


More information about the TYPO3-team-core mailing list