aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view
diff options
context:
space:
mode:
authorRui Onodera <deraru@gmail.com>2016-10-16 21:21:03 +0900
committerRui Onodera <deraru@gmail.com>2018-02-27 11:41:56 +0900
commite579c7430ab94d1bf31b91d3973b26ab69c8503c (patch)
tree88cfe43e1bf902376d19934da4ca90ccf2c98b04 /actionview/lib/action_view
parentf7157e48ea233eab56844dba4203f5149d910eaa (diff)
downloadrails-e579c7430ab94d1bf31b91d3973b26ab69c8503c.tar.gz
rails-e579c7430ab94d1bf31b91d3973b26ab69c8503c.tar.bz2
rails-e579c7430ab94d1bf31b91d3973b26ab69c8503c.zip
Change translation key of submit_tag from module_name_class_name to module_name/class_name
Currently submit_tag value translation does not support i18n key style locale key. It confuses me a bit because many other components support i18n key style locale key. I added i18n key style locale key support to submit tag.
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r--actionview/lib/action_view/helpers/form_helper.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb
index 15aa9ec2dd..e27628f58b 100644
--- a/actionview/lib/action_view/helpers/form_helper.rb
+++ b/actionview/lib/action_view/helpers/form_helper.rb
@@ -2266,7 +2266,12 @@ module ActionView
end
defaults = []
- defaults << :"helpers.submit.#{object_name}.#{key}"
+ # Object is a model and it is not overwritten by as and scope option.
+ if object.respond_to?(:model_name) && object_name.to_s == model.downcase
+ defaults << :"helpers.submit.#{object.model_name.i18n_key}.#{key}"
+ else
+ defaults << :"helpers.submit.#{object_name}.#{key}"
+ end
defaults << :"helpers.submit.#{key}"
defaults << "#{key.to_s.humanize} #{model}"