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, included

Methods included from GetText

N_, #Nn_, _, #add_default_locale_path, bindtextdomain, #bindtextdomain_to, bound_target, bound_targets, cached=, cached?, cgi, cgi=, charset=, clear_cache, create_mofiles, current_textdomain_info, each_textdomain, gettext, included, locale, locale=, msgmerge, msgmerge_all, n_, ngettext, ns_, nsgettext, output_charset, output_charset=, rgettext, rmsgfmt, rmsgmerge, s_, set_cgi, set_charset, 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



431
432
433
434
435
436
437
438
439
# File 'lib/gettext/rails.rb', line 431

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:



441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/gettext/rails.rb', line 441

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:



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

alias :create_without_gettext! :create!