![]() |
system/core/Lang.php bug - 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: system/core/Lang.php bug (/showthread.php?tid=48740) |
system/core/Lang.php bug - El Forum - 01-26-2012 [eluser]ksorbo[/eluser] I think this may be a bug or at least un-intended consequences. language defaults to English from the config.php file. My folder structure is: application __/english ____strings_lang.php __/spanish ____strings_lang.php My command to load spanish is Code: $this->lang->load('strings','spanish'); Using the existing Lang.php file, the idiom does not change. Am I missing something or is this a bug? My app is designed to allow the user to change languages while logged in. To do so, the user changes the language and the app loads the strings_lang.php file for the new language. However, it seems that the system is only designed for one idiom to load. In particular the code from the load function in system/core/Lang.php around lines 76-79 Code: if (in_array($langfile, $this->is_loaded, TRUE)) This code returns if the particular language file has been loaded but does not seem to pay any attention to whether this is a new idiom. My app loads English as default automatically. When my controller commands to load a new language, the Lang::loader says, this file has been loaded (albeit the English version) and returns without loading the new idiom. What I did was to comment out the above lines. Everything works as intended. (CI version 2.1) system/core/Lang.php bug - El Forum - 01-27-2012 [eluser]Narf[/eluser] Indeed, it's a bug - a fix is on the way. ![]() system/core/Lang.php bug - El Forum - 02-22-2012 [eluser]Narf[/eluser] Can you confirm if this solves the problem: https://github.com/EllisLab/CodeIgniter/pull/993 |