Class: ActionMailer::Base

Inherits:
Object
  • Object
show all
Extended by:
GetText::Rails
Includes:
GetText::Rails
Defined in:
lib/gettext/rails.rb

Overview

:nodoc:

Constant Summary

Constants included from GetText::Rails

GetText::Rails::Rails

Constants included from GetText

GetText::VERSION

Instance Method Summary collapse

Methods included from GetText::Rails

_bindtextdomain, bindtextdomain, bindtextdomain_to, callersrc, use_localized_templates, use_localized_templates?

Methods included from GetText

N_, #Nn_, _, #add_default_locale_path, bindtextdomain, callersrc, cgi, cgi=, charset=, create_mofiles, gettext, locale, locale=, msgmerge, msgmerge_all, n_, ngettext, output_charset, output_charset=, rgettext, rmsgfmt, rmsgmerge, s_, set_cgi, set_charset, set_locale, set_output_charset, setlocale, sgettext, textdomain, update_pofiles

Instance Method Details

#_create!Object

:nodoc:



384
# File 'lib/gettext/rails.rb', line 384

alias :_create! :create!

#base64(text, charset = "iso-2022-jp", convert = true) ⇒ Object



386
387
388
389
390
391
392
393
394
# File 'lib/gettext/rails.rb', line 386

def base64(text, charset="iso-2022-jp", convert=true)
  if convert
    if charset == "iso-2022-jp"
      text = NKF.nkf('-j -m0', text)
    end
  end
  text = TMail::Base64.folding_encode(text)
  "=?#{charset}?B?#{text}?="
end

#create!(*arg) ⇒ Object

:nodoc:



396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/gettext/rails.rb', line 396

def create!(*arg) #:nodoc:
  _create!(*arg)
  if Locale.get.language == "ja"
    require 'nkf'
    @mail.subject = base64(@mail.subject)
    part = @mail.parts.empty? ? @mail : @mail.parts.first
    if part.content_type == 'text/plain'
      part.charset = 'iso-2022-jp'
      part.body = NKF.nkf('-j', part.body)
    end
  end
  @mail
end