$helper = strtolower(str_replace(EXT, '', str_replace('_helper', '', $helper)).'_helper');
$langfile = str_replace(EXT, '', str_replace('_lang.', '', $langfile)).'_lang'.EXT;
There is a bug in the language code.
The developers allow you to load your language and helper files one of three ways:
account_lang.php
#1: $this->load->lang(‘account’);
#2: $this->load->lang(‘account_lang’);
#3: $this->load->lang(‘account_lang.php’);
account_helper.php
#1: $this->load->helper(‘account’);
#2: $this->load->helper(‘account_helper’);
#3: $this->load->helper(‘account_helper.php’);
The reason for the inner str_replace() is so that if you load your file like in #2, it will remove the “_lang” or “_helper” from it. Then the “_lang” or “_helper” is added back on. By doing this, you can load your stuff in any of the above three ways.
The bug though is in the language line. The period in “_lang.” should be removed and it should just read “_lang”. So here is the corrected code:
$langfile = str_replace(EXT, '', str_replace('_lang', '', $langfile)).'_lang'.EXT;
Personally, I wish that ALL loading classes worked the same way. Do away with the “_lang” and “_helper” forced requirement. Not only is it inconsistant with the other loaders (libraries and models) but it also slows down CI. I wish CI would load whatever is in the loader string in a what-you-type-is-what-you-get fashion:
HELPERS:
(account_helper.php)
$this->load->helper(‘account_helper’); // works
$this->load->helper(‘account’); // doesn’t work
(account.php)
$this->load->helper(‘account_helper’); // doesn’t work
$this->load->helper(‘account’); // works
etc etc for the rest of the helper functions…
(see my thread here for more information: http://codeigniter.com/forums/viewthread/51739/)