title: CodeIgniter getting CI load the correct language file when validating forms
body: <p>This is rather a call for testimonies than a real questions. I would greatly appreciate feedbacks from CI experts and fans.</p>
  
  <p>I have been searching the Internet for hours about this issue of mine: getting CI Form Validation class load the proper language file dynamically.</p>
  
  <p>Let me explain. In my config.php file, I have:</p>
  
  <pre><code>$config['language'] = 'english';
  </code></pre>
  
  <p>Which is indeed the default language. But I have implemented a Settings controller which is letting my users set some values and of course change their default language. I could have stored that setting into a session variable but for the moment I don't, I just load that language user setting into each controller within the constructor :</p>
  
  <pre><code>$this-&gt;idiom = get_user_setting('language');
  $this-&gt;lang-&gt;load('main', $this-&gt;idiom);
  $this-&gt;lang-&gt;load('settings', $this-&gt;idiom);
  $this-&gt;lang-&gt;load('cst', $this-&gt;idiom);
  </code></pre>
  
  <p>and as you can see I then load all the language files I need for each controller with the appropriate language. The 'get_user_setting' function is just a helper of mine querying the database to get a particular setting id.</p>
  
  <p>I have copied the form_validation_lang.php from the /system/language/english/ directory and put it into my /application/language/french/ directory, and then I thought doing the following would do the magic:</p>
  
  <pre><code>$this-&gt;lang-&gt;load('form_validation', $this-&gt;idiom);
  </code></pre>
  
  <p>But nope... does not change anything. I took a look at the Form Validation class in the core folder and saw the following:</p>
  
  <pre><code>// Load the language file containing error messages
  $this-&gt;CI-&gt;lang-&gt;load('form_validation');
  </code></pre>
  
  <p>THis clearly makes me think it will always load the file of the default language set in the config.php file. Am I right or wrong?</p>
  
  <p>Hence, the only way I got to have this work with my user defined settings I fetch from the database (and which I could also store in a session variable), is to do the following:</p>
  
  <pre><code>$this-&gt;idiom = get_user_setting('language');
  $this-&gt;config-&gt;set_item('language', $this-&gt;idiom);
  ...
  </code></pre>
  
  <p>I would greatly appreciate some feedbacks if some of you already had to cope with this kind of requirements and if you indeed managed that the same way I did or not. If I'm totally wrong, I'd appreciate solutions of course.</p>
  
  <p>THanks a lot for your help.</p>