aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/action_mailer
diff options
context:
space:
mode:
Diffstat (limited to 'actionmailer/lib/action_mailer')
-rw-r--r--actionmailer/lib/action_mailer/base.rb14
-rw-r--r--actionmailer/lib/action_mailer/locale/en-US.rb3
2 files changed, 12 insertions, 5 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 1518e23dfe..e787c1b8da 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -307,10 +307,6 @@ module ActionMailer #:nodoc:
# Specify the CC addresses for the message.
adv_attr_accessor :cc
- # Specify the charset to use for the message. This defaults to the
- # +default_charset+ specified for ActionMailer::Base.
- adv_attr_accessor :charset
-
# Specify the content type for the message. This defaults to <tt>text/plain</tt>
# in most cases, but can be automatically set in some situations.
adv_attr_accessor :content_type
@@ -348,6 +344,15 @@ module ActionMailer #:nodoc:
# have multiple mailer methods share the same template.
adv_attr_accessor :template
+ # Specify the charset to use for the message.
+ # It performs a lookup, on the specified charset, then on the charset from
+ # the current locale, and, finally, on the +default_charset+ specified
+ # for ActionMailer::Base.
+ def charset(charset = nil)
+ @charset ||= charset || :'charset'.t || @@default_charset
+ end
+ attr_writer :charset
+
# Override the mailer name, which defaults to an inflected version of the
# mailer's class name. If you want to use a template in a non-standard
# location, you can use this to specify that location.
@@ -517,7 +522,6 @@ module ActionMailer #:nodoc:
# mailer. Subclasses may override this method to provide different
# defaults.
def initialize_defaults(method_name)
- @charset ||= @@default_charset.dup
@content_type ||= @@default_content_type.dup
@implicit_parts_order ||= @@default_implicit_parts_order.dup
@template ||= method_name
diff --git a/actionmailer/lib/action_mailer/locale/en-US.rb b/actionmailer/lib/action_mailer/locale/en-US.rb
new file mode 100644
index 0000000000..369f2d1a1c
--- /dev/null
+++ b/actionmailer/lib/action_mailer/locale/en-US.rb
@@ -0,0 +1,3 @@
+I18n.backend.store_translations :'en-US', {
+ :charset => 'utf-8'
+} \ No newline at end of file