Reputation: 1150
I'm using Rails 2.3.6 and I18n. Everything works fine except that I18n is using the wrong locale when sending emails. In fact it renders the following code using en.yml instead of it.yml, although my default locale is it.
Can you help me?
class UserMailer < ActionMailer::Base
default_url_options[:host] = GAME_CONFIG["domain"]
def password_reset_instructions(user)
subject I18n.translate("email_messages.lost_password.subject")
from "#{GAME_CONFIG["name"]} <no-reply@#{GAME_CONFIG["domain"]}>"
recipients user.email
sent_on Time.now
body :edit_password_reset_url => edit_password_reset_url(user.perishable_token)
end
end
In my production server if I try to check for the current locale I get:
I18n.default_locale
:it
I18n.locale
:it
Upvotes: 1
Views: 804
Reputation: 1150
I discovered that this is normal behavior and I can fix this specifing :locale => ":it"
Upvotes: 1