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, available_locales, bindtextdomain, included, normalized_locale

Methods included from GetText

N_, #Nn_, _, #add_default_locale_path, bindtextdomain, #bindtextdomain_to, bound_target, bound_targets, cached=, cached?, cgi, cgi=, clear_cache, create_mofiles, current_textdomain_info, each_textdomain, find_targets, gettext, included, locale, locale=, msgmerge, msgmerge_all, n_, ngettext, ns_, nsgettext, output_charset, output_charset=, rgettext, rmsgfmt, rmsgmerge, s_, set_cgi, set_locale, set_locale_all, set_output_charset, setlocale, sgettext, textdomain, #textdomain_to, update_pofiles

Instance Method Details

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



438
439
440
441
442
443
444
445
446
# File 'lib/gettext/rails.rb', line 438

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:



448
449
450
451
452
453
454
455
456
457
458
459
460
# File 'lib/gettext/rails.rb', line 448

def create!(*arg) #:nodoc:
  create_without_gettext!(*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

#create_without_gettext!Object

:nodoc:



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

alias :create_without_gettext! :create!