aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorJason Garber <jg@jasongarber.com>2011-04-27 21:00:27 -0600
committerJason Garber <jg@jasongarber.com>2011-04-27 21:00:27 -0600
commita07cee62c7d23ec587ef961beb35ce3ac63df340 (patch)
tree8550de2122206e34ec0453d335f859ec5528a2d4 /actionpack/lib/action_view
parentbed6a775df086c58e7129805dec4cbe755856df2 (diff)
downloadrails-a07cee62c7d23ec587ef961beb35ce3ac63df340.tar.gz
rails-a07cee62c7d23ec587ef961beb35ce3ac63df340.tar.bz2
rails-a07cee62c7d23ec587ef961beb35ce3ac63df340.zip
Allow a label with the value option to have value-specific translations.
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 440acafa88..efe30441b1 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -947,7 +947,8 @@ module ActionView
label_tag(name_and_id["id"], options, &block)
else
content = if text.blank?
- I18n.t("helpers.label.#{object_name}.#{method_name}", :default => "").presence
+ method_and_value = tag_value.present? ? "#{method_name}.#{tag_value}" : method_name
+ I18n.t("helpers.label.#{object_name}.#{method_and_value}", :default => "").presence
else
text.to_s
end