CodeIgniter Forums
Loading incorrect language. - 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: Loading incorrect language. (/showthread.php?tid=58306)



Loading incorrect language. - El Forum - 06-01-2013

[eluser]pzntec[/eluser]
Hello!

I have the following code:
Code:
public function loadLangFile($lang='hungarian') {
  $toLoad = array('common', 'error', 'menu');
  $data = $this->lang->load($toLoad, $lang, TRUE);

  return $data;
}
Which should load the files common_lang.php, error_lang.php, and menu_lang.php from within the language/hungarian directory.

However my issue is that it doesn't. It tries to load from within the english directory spitting out this error:
Quote:Unable to load the requested language file: language/english/common_lang.php


If I remove the array and only put one of the language files, it loads fine.
Code:
$data = $this->lang->load('common', $lang, TRUE);


Furthermore, the Lang.php file which contains the load method says the first param can be an array.
Quote:@param mixed the name of the language file to be loaded. Can be an array


Unfortunately I can't debug the code for I keep getting a 'Disallowed Key Characters' error when trying to debug in my IDE.

Any help or tips on this matter would be appreciated.

Thank you! Smile


Loading incorrect language. - El Forum - 06-02-2013

[eluser]pzntec[/eluser]
Found the solution.

The problem was within the Modular Extensions - HMVC file.

changed the MX_Lang class
Code:
foreach($langfile as $_lang) $this->load($_lang);

to
Code:
foreach($langfile as $_lang) $this->load($_lang, $lang);