Reputation: 343
According to what I've read about loading custom languages in CodeIgniter, the language file must be loaded in the controller, then it will "passed" to the view.
Here it comes a performance issue. Every time a page is called, the server must load the language file. How can the language file be loaded only once? And then use it along the same session?
Thanks everyone.
Francesco
Upvotes: 0
Views: 237
Reputation: 7997
load the language file (e.g. general_lang.php
) in the constructor of your default controller like this:
function __construct(){
parent::__construct();
// some other stuff ...
$this->lang->load('general', 'english');
}
the language file is only called once (whenever you call you default controller, which is whenever you start a new session)
Upvotes: 1