I have a language file for my nav (nav_lang.php) that I want to use globally throughout my application. Codeigniter docs say you can include it in the $autoload[‘language’] array.
However, I only want to load the file for specific language for each user. So english/nav_lang instead of portuegeuse/nav_lang. I’ve already setup my URLs so that /en/ or /br/ is segment 1.
Is there a way to do this that avoids putting the code in every controller?
You can extend the CI_Controller and load the appropriate file there. All your Controllers will inherit from the new extended Controller and there will no repetition of code.