Hi,
It may be a bug of gettext-1.7.0.
Could you try this patch to your gettext/rails.rb ?
--- rails.rb.old 2006-08-15 00:31:42.000000000 +0900
+++ rails.rb 2006-08-15 00:33:08.000000000 +0900
@@ -60,7 +60,7 @@
# They are remained for backward compatibility.
#
def bindtextdomain(domainname, options = {}, locale = nil, charset = nil,
with_model = true)
- opt = {:with_helper => true, :with_model => true}
+ opt = {:with_helper => true, :with_model => true, :with_mailer => true}
if options.kind_of? CGI
# For backward compatibility
opt.merge!(:cgi => options, :locale => locale, :charset => charset,
:with_model => with_model)
@@ -73,6 +73,7 @@
ret = _bindtextdomain(domainname, opt)
bindtextdomain_to(ActiveRecord::Base, domainname) if opt[:with_model]
bindtextdomain_to(ApplicationHelper, domainname) if opt[:with_helper]
+ bindtextdomain_to(ActionMailer::Base, domainname) if opt[:with_mailer]
ret
end
On Mon, 14 Aug 2006 04:21:10 +0200
Stephane JAIS <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm using gettext 1.7.0 and rails 1.1.4.
>
> Gettext won't translate:
>
> * the subject line of my e-mail
> * the view that renders its body.
>
> I have followed the integration guide at:
> http://manuals.rubyonrails.org/read/chapter/105
>
> Here's what my application controller looks like:
>
> class ApplicationController < ActionController::Base
> before_filter :init_gettext
> def init_gettext
> bindtextdomain("myapp", request.cgi)
> end
>
> Here's my ActionMailer:
>
> class OrderMailer < ActionMailer::Base
> def confirm(order)
> @subject = _("Your order with myapp")
>
> The subject is not translated unless I call bindtextdomain right before.
>
> The rhtml template that generate the body is just not translated at all.
> I can still create localized versions of it:
> cp app/views/order_mailer/confirm.rhtml
> app/views/order_mailer/confirm_fr.rhtml
> but that's a little bit disapointing.
>
> Any idea how to get that _() function to work everywhere ?
>
> Thanks,
>
> Stephane.
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Railsi18n-discussion mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/railsi18n-discussion
>
--
--
.:% Masao Mutoh<[EMAIL PROTECTED]>
_______________________________________________
Railsi18n-discussion mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/railsi18n-discussion