I18n在电子邮件中使用了错误的语言环境,为什么?

时间:2011-06-01 13:37:22

标签: ruby-on-rails internationalization actionmailer

我正在使用Rails 2.3.6和I18n。一切正常,但I18n在发送电子邮件时使用了错误的语言环境。事实上,它使用en.yml而不是it.yml呈现以下代码,尽管我的默认语言环境是它。

你能帮助我吗?

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

在我的生产服务器中,如果我尝试检查当前的语言环境,我得到:

I18n.default_locale
:it
I18n.locale
:it

1 个答案:

答案 0 :(得分:0)

我发现这是正常行为,我可以修改此指定:locale =&gt; “:它”

相关问题