Forum: Rails I18n Issue with mail notification

Ee0293412faca21e4ebf3326ed9d5f8c?d=identicon&s=25 Kad Kerforn (kadoudal)
on 2010-02-06 17:38
(Received via mailing list)
Rails 2.3.5 / Ruby 1.8.7

Hi All

I have a small issue when using mail notification

my default locale is :en (but I have already 2 locales  :en , :fr  for
testing purpose

I have a Notifier model ..
class Notifier < ActionMailer::Base
...
  def activation_instructions(user)
    debugger
    subject       I18n.t("mail.subject.activation_instructions")
    from          Setting.mail_from
    recipients    user.email
    sent_on       Time.now
    body          :account_activation_url =>
register_url(user.perishable_token)
    body          :account_type => I18n.t("label.#{user.type}", :count
=> 1)
  end

all labels comes in English , that's fine....
BUT
I have 2 views ...
activation_instructions.html.erb
activation_instructions.fr.html.erb

and I always get the french version  email (with the english labels in
it...)  ......
it should be the english one (default)
what's wrong....  ?

thanks for your enlightments !!
Adce10d7f1dbabcdab8f525a59cec32f?d=identicon&s=25 Andrés Gutiérrez (andresgutgon)
on 2010-02-06 17:41
(Received via mailing list)
try to rename the english version to -->
activation_instructions.en.html.erb

2010/2/6 Erwin <yves_dufour@mac.com>

> class Notifier < ActionMailer::Base
> => 1)
> it should be the english one (default)
> rails-i18n+unsubscribe@googlegroups.com<rails-i18n%2Bunsubscribe@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/rails-i18n?hl=en.
>
>


--
Experiencia es lo que obtienes, cuando no obtienes lo que quieres.
390e714e320bd505fb5e9f762870ba5e?d=identicon&s=25 Krzysztof Knapik (Guest)
on 2010-02-06 18:30
(Received via mailing list)
ActionMailer by default supports full content-type extensions e.g:
text.plain.erb, text.html.erb, so you should follow this convention,
otherwise your fr.html is taken as content type ("fr/html").

And your templates should be named:

activation_instructions.text.html.erb
activation_instructions.fr.text.html.erb

Regards,
KK

2010/2/6 Erwin <yves_dufour@mac.com>:
390e714e320bd505fb5e9f762870ba5e?d=identicon&s=25 Krzysztof Knapik (Guest)
on 2010-02-06 18:33
(Received via mailing list)
and...

activation_instructions.text.plain.erb
activation_instructions.fr.text.plain.erb

if plain text message in enough for you. If you have both plain and
html, ActionMailer builds multipart/alternative email.

KK

2010/2/6 Krzysztof Knapik <krzysztof.knapik@gmail.com>:
Ee0293412faca21e4ebf3326ed9d5f8c?d=identicon&s=25 Kad Kerforn (kadoudal)
on 2010-02-07 09:07
(Received via mailing list)
It seems not to be working...
no problem when I get rid of the locale extension...
activation_instructions.text.html.erb   works
activation_instructions.fr.text.html.erb   doesn't work

but I discover this info :

http://blog.andischacke.com/2009/10/localized-acti...

:-))
This topic is locked and can not be replied to.