• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Localizing the error messages for rules in form_validation library

#1
[eluser]chamila[/eluser]
I am using the form_validation library, and I want the error messages that are displayed for rules like required, min_value to be dynamically selected from the language file according to the locale.

I can display the localized strings for the rest of the page by using template parser library. But I can't figure out the error messages.

I tried the following too, but it doesn't work. Gives out a lot of errors (required_error is the line in the lang file).

Code:
$this->form_validation->set_message("required", $this->lang->line("required_error"));

Can anyone help me out with this?

Thank you!

#2
[eluser]chamila[/eluser]
I found a solution for this.

Use the helper provided here.

http://maestric.com/doc/php/codeigniter_i18n

The extra work includes putting entries in the My_language.php, routes.php and writing the language file.

If you come across any strange characters check the charset attribute of the html header to be utf-8.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.