A localization helper in codeigniter 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-&gt;session-&gt;get_userdata('language'))
    {
        $this-&gt;lang-&gt;load($lang_file,$this-&gt;session-&gt;get_userdata('language'));
    }else
    {
        $this-&gt;lang-&gt;load($lang_file);
    }
}


so everytime instead use

$this-&gt;lang-&gt;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.
This is pretty trivial example for review, but you are right to question use of this function from within a view.

Personally I think this is information that needs to be determined upstream of this decision point, making the function unnecessary.

If you always used this format for loading language:

$this-&gt;lang-&gt;load($lang_file, $lang);


where $lang here could be a variable, constant, call to static class method, or some other way to get to the current language preference (with this preference determined somewhere outside the logic for actually loading the localization).