I created a project to better understand CI3, while developing it I tried to introduce localization elements.
When I tried to localize the view everything messed up. I made a helper to identify if the user choose a language different than default language then load the right language.
function lang_load($lang_file)
{
if($this->session->get_userdata('language'))
{
$this->lang->load($lang_file,$this->session->get_userdata('language'));
}else
{
$this->lang->load($lang_file);
}
}
so everytime instead use
$this->lang->load($lang_file);
I use
lang_load($lang_file)
I use it on Controllers and in the Views, but I guess it is breaking the MVC principle when used on view side.