module ActionMailer #:nodoc: # In addition to including GLoc, render_message is also overridden so # that mail templates contain the current language at the end of the file. # Eg. deliver_hello will render hello_en.rhtml. class Base include GLoc private alias :render_message_without_gloc :render_message def render_message(method_name, body) template_name_portion = method_name.split(".") localized_template = (["#{template_name_portion[0]}_#{current_language}"] + template_name_portion[1..10]).join(".") template = File.exist?("#{template_path}/#{localized_template}") ? localized_template : "#{method_name}" render_message_without_gloc(template, body) end end end