Welcome Guest, Not a member yet? Register   Sign In
Languages
#1

[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.
#2

[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);




Theme © iAndrew 2016 - Forum software by © MyBB