diff options
author | Luca Guidi <guidi.luca@gmail.com> | 2008-07-01 16:52:48 +0200 |
---|---|---|
committer | Luca Guidi <guidi.luca@gmail.com> | 2008-07-01 16:52:48 +0200 |
commit | 6982acb0793fb6e59f52cab4062344a88e3691ce (patch) | |
tree | 631d44e4818c882c0c774ebde961b30184afd289 /actionmailer/lib | |
parent | 66c2508ebbca06e551255a76cc47a1608f091992 (diff) | |
download | rails-6982acb0793fb6e59f52cab4062344a88e3691ce.tar.gz rails-6982acb0793fb6e59f52cab4062344a88e3691ce.tar.bz2 rails-6982acb0793fb6e59f52cab4062344a88e3691ce.zip |
Experimental I18n charset support for ActionMailer
Diffstat (limited to 'actionmailer/lib')
-rwxr-xr-x | actionmailer/lib/action_mailer.rb | 4 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 14 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/locale/en-US.rb | 3 |
3 files changed, 16 insertions, 5 deletions
diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb index 2e324d4637..806edf1f9e 100755 --- a/actionmailer/lib/action_mailer.rb +++ b/actionmailer/lib/action_mailer.rb @@ -49,4 +49,8 @@ ActionMailer::Base.class_eval do helper MailHelper end +I18n.backend.populate do + require 'action_mailer/locale/en-US.rb' +end + silence_warnings { TMail::Encoder.const_set("MAX_LINE_LEN", 200) } 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 |