How do I add links that select my preferred language (CodeIgniter language class)?

I just finished this tutorial:

http://codeigniter.com/wiki/Internationalization_and_the_Template_Parser_Class/

but now i want some links to change english

tospanish

I know how to change it by changing the controller example.php

:

# Load language
$this->lang->load('example', 'english');

      

But I cannot figure out how to do this in the view file example.php

What's the easiest and best way to do this?

+2


a source to share


1 answer


You should do something like this:

function set_lang($lang)
{
    return $this->config->set_item('language', $lang);
}

      



You should also add the "language" library to your autoload config, and then just put the $ this-> lang-> () line in the appropriate places.

+1


a source







All Articles