• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sets of rules - Translation

#1
[eluser]Mauricio de Abreu Antunes[/eluser]
Hello,

I need help with this problem:
I have sets of rules for form validation. But i need to translate field in messages. I know how to translate error messages, but labels not (with sets/groups http://ellislab.com/codeigniter/user-gui...ation.html).

Any idea?

#2
[eluser]Kamarg[/eluser]
Prefix your label with "lang:" in your validation rule. For example, if you have a field in your language file called "field_label_1" your validation rule label would be "lang:field_label_1".

#3
[eluser]Mauricio de Abreu Antunes[/eluser]
Code:
$config = array(
               array(
                     'field'   => 'username',
                     'label'   => 'Username',
                     'rules'   => 'required'
                  ),
               array(
                     'field'   => 'password',
                     'label'   => 'Password',
                     'rules'   => 'required'
                  ),
               array(
                     'field'   => 'passconf',
                     'label'   => 'Password Confirmation',
                     'rules'   => 'required'
                  ),  
               array(
                     'field'   => 'email',
                     'label'   => 'Email',
                     'rules'   => 'required'
                  )
            );

If i put lang in 'label' index, does it work?

#4
[eluser]Kamarg[/eluser]
Yes. You want "lang:" at the start of each of those label fields.

#5
[eluser]Mauricio de Abreu Antunes[/eluser]
Thanks, gonna try out this! :-)


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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