CodeIgniter Forums
Languages - 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: Languages (/showthread.php?tid=27349)



Languages - El Forum - 02-08-2010

[eluser]Unknown[/eluser]
Hi. I wanna make a multilanguage website, but I do not want that the language appear in URI like example.com/fr/about (I do not want this). I just want to change the text language. My problem is that the first load language that I do is for ever. why?
If I do:
$this->config->set_item('language','english');
$this->lang->load('messages');
$this->config->set_item('language','french');
$this->lang->load('messages');

or
$this->lang->load('messages','english');
$this->lang->load('messages','french');

just the english appear. How can I fix this?

My config language autoload is empty.

Thank you for your help.


Languages - El Forum - 02-08-2010

[eluser]tomcode[/eluser]
Welcome xptohacking,

You need to set the language before You load language files.

You cannot load several versions of the same language file (say english/my_lang.php and french/my_lang.php).

The second parameter of $this->lang->load() allows You only to load a file in another language than specified in the configuration.

If You want to use several versions of the same language file, You need to set the third param of $this->lang->load(), but this won't 'load' the strings for use with $this->lang->line(), it will return the strings :

Code:
$english_strings = $this->lang->load('my_lang', 'english', true);

$french_strings = $this->lang->load('my_lang', 'french', true);