How can I translate form fields name in error messages?

386 views
Skip to first unread message

Mitchell Gould

unread,
Jan 4, 2011, 10:17:58 AM1/4/11
to rails...@googlegroups.com
I have a form with labels that I translate using the I18n format with
YAML files.

If the user does not fill in a field properly on the form an error
message is displayed.

I have managed to set up the YAML file to translate the messages but the
name of the field in the error message does not get translated.

For example:
City doit être rempli

How to I make sure the field names are translated in the error message?

Thanks in advance.

Mitch

Attachments:
http://www.ruby-forum.com/attachment/5650/Picture_3.png


--
Posted via http://www.ruby-forum.com/.

Andrés gutiérrez

unread,
Jan 4, 2011, 10:57:33 AM1/4/11
to rails...@googlegroups.com


2011/1/4 Mitchell Gould <li...@ruby-forum.com>

I have a form with labels that I translate using the I18n format with
YAML files.

If the user does not fill in a field properly on the form an error
message is displayed.

I have managed to set up the YAML file to translate the messages but the
name of the field in the error message does not get translated.

For example:
City doit être rempli

Mybe this help you:
http://edgeguides.rubyonrails.org/i18n.html#translations-for-active-record-models
en:
  activerecord:
    models:
      city: city in german
 

How to I make sure the field names are translated in the error message?

Thanks in advance.

Mitch

Attachments:
http://www.ruby-forum.com/attachment/5650/Picture_3.png


--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "rails-i18n" group.
To post to this group, send email to rails...@googlegroups.com.
To unsubscribe from this group, send email to rails-i18n+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rails-i18n?hl=en.


Mitchell Gould

unread,
Jan 4, 2011, 10:17:29 PM1/4/11
to rails...@googlegroups.com
Andrés Gutiérrez wrote in post #972249:
> 2011/1/4 Mitchell Gould <li...@ruby-forum.com>
>
>> City doit tre rempli

>>
>
> Mybe this help you:
>
http://edgeguides.rubyonrails.org/i18n.html#translations-for-active-record-models
> en:
> activerecord:
> models:
> city: city in german

Thank you very much that is perfect

Andrés gutiérrez

unread,
Jan 5, 2011, 3:33:38 AM1/5/11
to rails...@googlegroups.com


2011/1/5 Mitchell Gould <li...@ruby-forum.com>

Andrés Gutiérrez wrote in post #972249:
> 2011/1/4 Mitchell Gould <li...@ruby-forum.com>
>
>> City doit tre rempli
>>
>
> Mybe this help you:
>
http://edgeguides.rubyonrails.org/i18n.html#translations-for-active-record-models
> en:
>   activerecord:
>     models:
>       city: city in german

Thank you very much that is perfect
Great :)

--

Andrés Mejía

unread,
Jan 5, 2011, 4:21:29 AM1/5/11
to rails...@googlegroups.com
Just for clarification: " City doit être rempli" is French and not German ;)

2011/1/5 Andrés gutiérrez <andres...@gmail.com>

Andrés gutiérrez

unread,
Jan 5, 2011, 4:33:37 AM1/5/11
to rails...@googlegroups.com
El 5 de enero de 2011 10:21, Andrés Mejía <and...@gmail.com> escribió:
Just for clarification: " City doit être rempli" is French and not German ;)
Thanks :)

Translate Humans

unread,
Mar 26, 2012, 7:54:43 AM3/26/12
to rails...@googlegroups.com
On top of respond are actually ideal. They specified all answer intended
for translate form fields name in error messages.
Reply all
Reply to author
Forward
0 new messages