Ruby on rails I18n在电子邮件中使用错误的区域设置,为什么?
我使用的是Rails 2.3.6和I18n。除了I18n在发送电子邮件时使用了错误的区域设置外,其他一切都正常工作。事实上,它使用en.yml而不是it.yml呈现以下代码,尽管我的默认语言环境是it 你能帮我吗Ruby on rails I18n在电子邮件中使用错误的区域设置,为什么?,ruby-on-rails,internationalization,actionmailer,Ruby On Rails,Internationalization,Actionmailer,我使用的是Rails 2.3.6和I18n。除了I18n在发送电子邮件时使用了错误的区域设置外,其他一切都正常工作。事实上,它使用en.yml而不是it.yml呈现以下代码,尽管我的默认语言环境是it 你能帮我吗 class UserMailer < ActionMailer::Base default_url_options[:host] = GAME_CONFIG["domain"] def password_reset_instructions(user) s
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
我发现这是正常的行为,我可以修复这个指定:locale=>“:it”请在哪里指定?每次调用I18n方法时。例如I18n.translate(“email\u messages.lost\u password.subject”,:locale=>“:it”)
I18n.default_locale
:it
I18n.locale
:it