I'm currently using the Localization generator as a part of the Salted Hash Login Generator. As has been noted in the page
http://wiki.rubyonrails.com/rails/show/SaltedHashLoginGenerator
This module appears to have broken. I've come up with a different solution than noted there. If the ActionMailer::Base class would assign @template in the constructor, instead of in the create! method (in the manner done in the patch), then one could override the naming conventions used by action mailer as follows:
Module Localization
CONFIG = {
:default_language => 'en'
}
class Mailer < ActionMailer::Base
def initialize( method_name, *parameters )
@template = method_name + "_#{CONFIG[:default_language]}"
super
end
end
end
To using the custom naming conventions, I would simply replace inheritance from ActionMailer::Base with Localization::Mailer.
Unfortunately, I don't see an "upload file" link on this form. I will attempt to attach the file after posting this message, but in case I cannot get it to work, here is the patch:
Index: base.rb
===================================================================
--- base.rb (revision 1816)
+++ base.rb (working copy)
@@ -165,6 +165,7 @@
# remain uninitialized (useful when you only need to invoke the "receive"
# method, for instance).
def initialize(method_name=nil, *parameters) #:nodoc:
+ @template = method_name if @template.nil?
create!(method_name, *parameters) if method_name
end
@@ -175,7 +176,6 @@
@charset = @@default_charset.dup
@content_type = @@default_content_type.dup
@implicit_parts_order = @@default_implicit_parts_order.dup
- @template = method_name
@parts = []
@headers = {}
@body = {}
I have tested this patch using customized tests, and the original test suite, on linux with success for all tests.
Thanks,
Brett