I'm using latest codeigniter 3.1.3
There is instruction how to use languages https://www.codeigniter.com/userguide3/libraries/language.html#handling-multiple-languages
$idiom = $this->session->get_userdata('language');
$this->lang->load('error_messages', $idiom); --> gives ERROR (home_view line 14)
$oops = $this->lang->line('message_key');
echo $oops;
but if i write that lines of code I get following error:
A PHP Error was encountered
Severity: Warning
Message: preg_match() expects parameter 2 to be string, array given
Filename: core/Lang.php
Line Number: 109
Backtrace:
File: .../application/views/home_view.php Line: 14 Function: load
File: .../controllers/Home.php Line: 14 Function: view
File: .../project/index.php Line: 315 Function: require_once
If I remove
$idiom = $this->session->get_userdata('language');
$this->lang->load('error_messages', $idiom); --> ERROR (home_view
and place in autoload.php
$autoload['language'] = array('error_messages');
everything is fine.
But I don't want to autoload all language files since I don't know if user needs everyone of them.
Anyone can help?
thanks