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