CodeIgniter Forums

Full Version: Translate database
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Gerep[/eluser]
Hi fellas,

I have found this code to show database error messages:
Code:
$data = array('name' => 'John', 'email' => '[email protected]');
$str = $this->db->insert_string('customers', $data);

// returns null if SQL error occurs.
$res = $this->db->query($str);

if (!$res) {
  // if query returns null
  $msg = $this->db->_error_message();
  $num = $this->db->_error_number();

  $data['msg'] = "Error(".$num.") ".$msg;
  $this->load->view('customers_edit_view',$data);
}

It is working perfectly but its showing the error in English, is there a way to translate this message?

Thanks in advance.

El Forum

[eluser]InsiteFX[/eluser]
Use CI Language Class!

InsiteFX

El Forum

[eluser]Gerep[/eluser]
Hi Insite

The Language Class do not have the string for all errors

For instance, the error for duplicate ID.

Is it possible to translate those messages without the language class?

El Forum

[eluser]InsiteFX[/eluser]
Check the language files in system/language/en/db_lang.php

InsiteFX