【发布时间】:2011-06-01 13:37:21
【问题描述】:
我使用的是 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
【问题讨论】:
标签: ruby-on-rails internationalization actionmailer