A localization helper in codeigniter
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).