diff --git a/actionview/lib/action_view/helpers/tags/label.rb b/actionview/lib/action_view/helpers/tags/label.rb index 4159cb105f351..b31d5fda66bfe 100644 --- a/actionview/lib/action_view/helpers/tags/label.rb +++ b/actionview/lib/action_view/helpers/tags/label.rb @@ -18,7 +18,7 @@ def translation content ||= Translator .new(object, @object_name, method_and_value, scope: "helpers.label") - .call + .translate content ||= @method_name.humanize content diff --git a/actionview/lib/action_view/helpers/tags/placeholderable.rb b/actionview/lib/action_view/helpers/tags/placeholderable.rb index db16ea7b0b0ae..cf7b117614d97 100644 --- a/actionview/lib/action_view/helpers/tags/placeholderable.rb +++ b/actionview/lib/action_view/helpers/tags/placeholderable.rb @@ -11,7 +11,7 @@ def initialize(*) placeholder ||= Tags::Translator .new(object, @object_name, method_and_value, scope: "helpers.placeholder") - .call + .translate placeholder ||= @method_name.humanize @options[:placeholder] = placeholder end diff --git a/actionview/lib/action_view/helpers/tags/translator.rb b/actionview/lib/action_view/helpers/tags/translator.rb index 86d7d2130887a..829679851cd93 100644 --- a/actionview/lib/action_view/helpers/tags/translator.rb +++ b/actionview/lib/action_view/helpers/tags/translator.rb @@ -9,7 +9,7 @@ def initialize(object, object_name, method_and_value, scope:) @model = object.respond_to?(:to_model) ? object.to_model : object end - def call + def translate translated_attribute = I18n.t("#{object_name}.#{method_and_value}", default: i18n_default, scope: scope).presence translated_attribute || human_attribute_name end