Masao Mutoh wrote:
> init_gettext can't accept lang value as 2nd parameter.
> Call GetText.locale= before initialize gettext.
> 
> GetText.locale = "nl"
> init_gettext 'myapp'
> 
> BTW,  I don't know it works with cron.
> If it doesn't work with init_gettext, try bindtextdomain as
> Mihnea said.
> 
> GetText.locale = "nl"
> bindtextdomain 'myapp'
> 
> Anyway, try 1.8.0 not 1.7.0.

I'm using 1.8.0.

Using init_gettext generates an error message. The second suggestion 
does work, but only within the model itself, so far.

Here's what I have in the model:

require 'gettext/rails'
class Mymailer < ActionMailer::Base
  def send_a_mail(email, language)
    GetText.locale = language
    bindtextdomain 'my app'
    @subject    = _('You have a winning combination!')
    @recipients = email
  end

This succesfully translates the subject, but the body of the email (a 
view), doesn't get translated. Can I use translatable strings in the 
actionmailer views or should I created seperate files (like 
mail_nl.rhtml,...)?

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Railsi18n-discussion mailing list
Railsi18n-discussion@rubyforge.org
http://rubyforge.org/mailman/listinfo/railsi18n-discussion

Reply via email to