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

Franz Holzinger franz at fholzinger.com
Wed Sep 17 09:08:14 CEST 2008


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.

- Franz



More information about the TYPO3-team-core mailing list