lib/globalize/rails/action_mailer.rb
# Initialize the mailer via the given +method_name+. The body will be
# rendered and a new TMail::Mail object created.
#
# This method is overriden by Globalize to support multiple templates
# for different locales. For example, use:
#   signup_notification.en-US.text.html.rhtml
# It is fully backwards compatible with the original rails version.

Initialize the mailer via the given +method_name+. The body will be
rendered and a new TMail::Mail object created.

This method is overriden by Globalize to support multiple templates
for different locales. For example, use:
signup_notification.en-US.text.html.rhtml
It is fully backwards compatible with the original rails version.
Initialize the mailer via the given + method_name + . The body will be rendered and a new TMail :: Mail object created . This method is overriden by Globalize to support multiple templates for different locales . For example use : signup_notification . en - US . text . html . rhtml It is fully backwards compatible with the original rails version .
def append_localized_parts
        codes = locale_codes
        codes.each do |code|
          if code
            templates = Dir.glob("#{template_path}/#{@template}.#{code}.*")
            template_regex = Regexp.new("^([^\\\.]+)\\\.(" + code + ")\\\.([^\\\.]+\\\.[^\\\.]+)\\\.(" + template_extensions.join('|') + ")$")
            type_index = 2
          else
            templates = Dir.glob("#{template_path}/#{@template}.*")
            template_regex = Regexp.new("^([^\\\.]+)\\\.([^\\\.]+\\\.[^\\\.]+)\\\.(" + template_extensions.join('|') + ")$")
            type_index = 1
          end
          templates.each do |path|
            basename = File.basename(path)
            next unless md = template_regex.match(basename)
            template_name = basename
            content_type = md.captures[type_index].gsub('.', '/')
            @parts << Part.new(:content_type => content_type,
              :disposition => "inline", :charset => charset,
              :body => render_message(template_name, @body))
          end
        end
      end
def append_localized_parts codes = locale_codes codes . each do | code | if code templates = Dir . glob ( "#{template_path}/#{@template}.#{code}.*" ) template_regex = Regexp . new ( "^([^\\\.]+)\\\.(" + code + ")\\\.([^\\\.]+\\\.[^\\\.]+)\\\.(" + template_extensions . join ( '|' ) + ")$" ) type_index = 2 else templates = Dir . glob ( "#{template_path}/#{@template}.*" ) template_regex = Regexp . new ( "^([^\\\.]+)\\\.([^\\\.]+\\\.[^\\\.]+)\\\.(" + template_extensions . join ( '|' ) + ")$" ) type_index = 1 end templates . each do | path | basename = File . basename ( path ) next unless md = template_regex . match ( basename ) template_name = basename content_type = md . captures [ type_index ] . gsub ( '.' , '/' ) @parts << Part . new ( :content_type => content_type , :disposition => "inline" , :charset => charset , :body => render_message ( template_name , @body ) ) end end end
Initialize the mailer via the given +method_name+.
Initialize the mailer via the given + method_name + .
#sections = basename.split(".")[0..-2] || []
 ## skip if this is some other language
 #next if !code && Globalize::RFC_3066.valid?(sections[1])
 #
 ## skip either template name and locale, or just template name
 #type_sections = code ? sections[2..-1] : sections[1..-1]
 #type = type_sections.join("/")
 #next if type.empty?
 #pth = path.split('/')[1..-1].join('/')
 #puts pth
 #
 #@parts << Part.new(:content_type => type,
 #  :disposition => "inline", :charset => charset,
 #  :body => render_message(pth, @body))
 # if we found templates at this stage, no need to continue to defaults
 # break if !templates.empty?
