Is there a way to translate the labels in a scaffold? Using <%= f.label :lastname %> instead of having to change that to <label><%= t(:firstname) %></label> -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2011/11/22 Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> Using <%= f.label :lastname %> instead of having to change that to > <label><%= t(:firstname) %></label>Cant test it straight away, but f.label(t(:whatever)) should do the trick -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Norbert Melzer wrote in post #1033193:> Cant test it straight away, but > > f.label(t(:whatever)) > > should do the trickThanks. Would be great if the possibility to localize could be built-in directly in scaffold. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2011/11/22 Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> Norbert Melzer wrote in post #1033193: >> Cant test it straight away, but >> >> f.label(t(:whatever)) >> >> should do the trick > > Thanks. > > Would be great if the possibility to localize could be built-in directly > in scaffold.After some more research, it is! Given a Model "User" with the attribute "name" some view with a form in it: form_for @user do |f| f.label :name end this will create a label for the input field with id :name AND label this according to the result that "User.human_attribute_name(:name)" would give. just see label as an alias for f.label :name, @user.class.human_attribute_name(:name) Put in your locale then this structure: en: activerecord: attributes: user: name: "The word your mother says when refering to you" I stumbled upon this during my research. I wanted to create scaffold generators that do I18n. Here is the URL to the guides: <http://guides.rubyonrails.org/i18n.html#translations-for-active-record-models> HTH Norbert -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.