CodeIgniter Forums
Language library 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: Language library bug (/showthread.php?tid=17036)



Language library bug - El Forum - 03-24-2009

[eluser]klezmer41[/eluser]
Using this method to change language files did not work (maybe because the files are named the same?):

$this->lang->load('main', 'eng');
$this->lang->load('main', 'fra');

This method did work:

$this->lang->load('eng_main', 'eng');
$this->lang->load('fra_main', 'fra');

Either one should work because the files existed in language/eng/ and language/fra/

Is this a bug?


Language library bug - El Forum - 03-24-2009

[eluser]xwero[/eluser]
In the CI language class you can't load two files with the same content because the second one will overwrite the other, in that view it's no bug.

Have a look at my take on the language library.


Language library bug - El Forum - 03-24-2009

[eluser]klezmer41[/eluser]
With your method, can I do this if the files are named the same?

$this->lang->load('file','idiom1');
$this->lang->load('file','idiom2');

Or do I need to use your method?

$this->lang->load('file',array('','idiom'));


Language library bug - El Forum - 03-24-2009

[eluser]xwero[/eluser]
you can do as you are used to but $this->lang->load('main',array('eng','fra')) is easier, not?


Language library bug - El Forum - 03-24-2009

[eluser]klezmer41[/eluser]
I can't seem to get yours to work, otherwise it sounds like a great idea...


Language library bug - El Forum - 03-24-2009

[eluser]xwero[/eluser]
How did you add it?


Language library bug - El Forum - 03-24-2009

[eluser]klezmer41[/eluser]
I replaced the class in the Language.php file and left everything else the same. Is there something else I need to do?


Language library bug - El Forum - 03-24-2009

[eluser]xwero[/eluser]
in the system/libraries directory?


Language library bug - El Forum - 03-24-2009

[eluser]klezmer41[/eluser]
Yep.


Language library bug - El Forum - 03-24-2009

[eluser]xwero[/eluser]
It works for me using
Code:
$this->lang->load('main',array('eng','fra'));

echo $this->lang->line('test','fra');
echo $this->lang->line('test','eng');
There are a few things i can think of why it doesn't work for you:

- the main file is named main.php instead of main_lang.php
- <?php is missing in the beginning of the file
- you didn't add the second parameter of the line method
- the index you call in the line method doesn't exist