Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionMailer#default_i18n_subject i18n scope add 'actionmailer' prefix. #4389

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions actionmailer/lib/action_mailer/base.rb
Expand Up @@ -523,7 +523,7 @@ def attachments
#
# * <tt>:subject</tt> - The subject of the message, if this is omitted, Action Mailer will
# ask the Rails I18n class for a translated <tt>:subject</tt> in the scope of
# <tt>[mailer_scope, action_name]</tt> or if this is missing, will translate the
# <tt>[:actionmailer, mailer_scope, action_name]</tt> or if this is missing, will translate the
# humanized version of the <tt>action_name</tt>
# * <tt>:to</tt> - Who the message is destined for, can be a string of addresses, or an array
# of addresses.
Expand Down Expand Up @@ -667,12 +667,12 @@ def set_content_type(m, user_content_type, class_default)
end
end

# Translates the +subject+ using Rails I18n class under <tt>[mailer_scope, action_name]</tt> scope.
# Translates the +subject+ using Rails I18n class under <tt>[:actionmailer, mailer_scope, action_name]</tt> scope.
# If it does not find a translation for the +subject+ under the specified scope it will default to a
# humanized version of the <tt>action_name</tt>.
def default_i18n_subject #:nodoc:
mailer_scope = self.class.mailer_name.gsub('/', '.')
I18n.t(:subject, :scope => [mailer_scope, action_name], :default => action_name.humanize)
I18n.t(:subject, :scope => [:actionmailer, mailer_scope, action_name], :default => action_name.humanize)
end

def collect_responses_and_parts_order(headers) #:nodoc:
Expand Down
2 changes: 1 addition & 1 deletion actionmailer/test/base_test.rb
Expand Up @@ -201,7 +201,7 @@ def teardown
email = BaseMailer.welcome(:subject => nil)
assert_equal "Welcome", email.subject

I18n.backend.store_translations('en', :base_mailer => {:welcome => {:subject => "New Subject!"}})
I18n.backend.store_translations('en', :actionmailer => {:base_mailer => {:welcome => {:subject => "New Subject!"}}})
email = BaseMailer.welcome(:subject => nil)
assert_equal "New Subject!", email.subject
end
Expand Down