The config file loads first and so the default language is picked from there. But I need to change the default language dynamically through button click. How can I do that? In my controller I have
public function __construct()
{
parent::__construct();
$this->config->set_item('language', 'japanese');
$this->load->helper('language');
$this->lang->load('fileimport');
var_dump(lang('message_missing_csvfile_import'));
}
This will display the value in japanese language
config.php is as follows:
$config['language'] = 'english';
autoload.php is as follows:
$autoload['language'] = array(
'application'
);
My view is as follows:
<form action ='<?php echo current_url(); ?>' enctype =
'multipart/form-data' method ='post' name="formtest" id="formtest">
<div>
<select id="main_language" name ="main_language">
<option>English</option>
<option>Japanese</option>
</select>
<input id="main_lang_button" type="button" value="Set Main Language">
</div></form>