Hi Stephane,

I try gettext using:

class ApplicationController < ActionController::Base
   init_gettext "myapp"
   ...
end

and it works.


Alternative with bindtextdomain:

I'm not sure, but when using bindtextdomain for tests it
was looking for the mo-file in locale/de/myapp.mo and
not in locale/de/LC_MESSAGES/myapp.mo so you may have to
try with different directories.

Or add a path:

add_default_locale_path(
   File.dirname(__FILE__) + "/locale/%{locale}/LC_MESSAGES/%{name}.mo" )


May it helps.

Thomas




Am 14.08.2006 um 04:21 schrieb Stephane JAIS:

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

---
Thomas Baustert - Freiberuflicher Softwarecoach
fon: +49(40)411 622 35 mobil: +49(173)23 911 43
fax: +49(40)411 622 36
thomas.baustert(at)b-simple.de





_______________________________________________
Railsi18n-discussion mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/railsi18n-discussion

Reply via email to