CodeIgniter Forums
autoload language not switching - why? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: autoload language not switching - why? (/showthread.php?tid=27537)



autoload language not switching - why? - El Forum - 02-13-2010

[eluser]aggrav8d[/eluser]
I've been moving all the strings into language files. I auto-load the common strings file. when I switch between languages the common strings file is always the English version, while the rest of the loaded-at-constructor language files swap as expected. What am I doing wrong? The site uses CI 1.7.2.


autoload language not switching - why? - El Forum - 02-13-2010

[eluser]tomcode[/eluser]
You need to switch the language before You load the language files.

Additionally : You cannot reload a once loaded language file.

In practice : do not autoload language files on a multi language site.


autoload language not switching - why? - El Forum - 02-13-2010

[eluser]aggrav8d[/eluser]
Yeah, I was calling my swap language handler as a post-constructor hook and loading the language files the MY_Controller constructor. Once I got rid of the hook and made sure the handler happened before the language file load, everything was good.

Thanks for the tip!