Hello,
I keep running into a problem with the Language class, and it’s driving me spare.
There are times when the Language class needs to be loaded and instantiated manually, typically when running some code from the ‘sessions_start’ hook.
In the past, it was possible to do something like this:
if ( ! class_exists('Language'))
{
require_once PATH_CORE .'core.language' .EXT;
$LANG = new Language();
$LANG->fetch_language_file(strtolower(get_class($this));
}
echo $LANG->line('something');In 1.6.8, a global ‘lang’ function was added, for use in View files. This would be all fine and dandy, but for the fact that core.system.php uses ‘require’, instead of ‘require_once’ to load the core.language.php file.
This results in a “cannot redeclare lang()” error, and as far as I can tell, there’s no way around it.
Am I missing something obvious here, or doing something horribly ill-advised? Or should this be filed as a bug?
Any pointers would be much appreciated.
Cheers,
Stephen