CodeIgniter Forums
Problem in language load() - 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: Problem in language load() (/showthread.php?tid=2164)



Problem in language load() - El Forum - 07-19-2007

[eluser]starbbs[/eluser]
In the language file, there is still a problem with the load() function. What happens if a user want to switch languages inside his preferences ?

Code:
if (in_array($langfile, $this->is_loaded, TRUE))
{
return;
}

doesnt this code prevents to load a other language file ? because it already loaded say: the english in stead of the french ?


Problem in language load() - El Forum - 07-19-2007

[eluser]starbbs[/eluser]
After a quick look at the new version, i saw that there is still a loading problem inside the language file. This prevents to load a new language after a language was already loaded. Say someone in his preferences, has setup to load the english language. Online, he decided to switch to german, than the load() function prevents that:

Code:
if (in_array($langfile, $this->is_loaded, TRUE))
{
  return;
}

This code checks if a language file was already loaded. If so, it returns.

A possible simple fix is to add the directory name into the is_loaded() array. This way you can change directory's.

so in stead:

Code:
$this->is_loaded[] = $langfile;

change to:

Code:
$this->is_loaded[] = $idiom.'/'.$langfile;