This project is archived and is in readonly mode.

#4035 ✓duplicate
Antonio Espinosa

Patch for internationalization (I18n) of label method when binding a form with form_for

Reported by Antonio Espinosa | February 22nd, 2010 @ 03:38 PM


I am a newbie in Rails' community and this is my first suggestion to participate to the wonderful Rails' adventure.

The problem I have encountered is that the label method in the form_for helper is not internationalized.


a view:

<% form_for @user, :url => { :controller => :users, :action => :send_signup } do |f| %>
  <%= f.label :name %><br />
  <%= f.text_field :name %>
  <%= f.submit I18n.t(:send) %>
<% end %>
Return label text: Name
But I want Nom because I use the french locale.

My suggestion is to add the support of I18n to the label method:

fr.yml (locale for french)

        name: Nom


Version: Rails 2.3.5
File: ../actionpack-2.3.5/lib/action_view/helpers/form_helper.rb

Line 742: content = (text.blank? ? nil : text.to_s) || method_name.humanize


Line 742: content = (text.blank? ? nil : text.to_s) || I18n.t(method_name, :default => method_name.humanize, :scope => [:activerecord, :attributes, object_name])

I hope this will be helpful.

Best regards,

A. Espinosa

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket