0

我正在使用具有此电子邮件方法的 gem:

  #Sends and email for indicating a reply in an already created conversation
  def reply_message_email(message,receiver)
    @message = message
    @receiver = receiver
    subject = message.subject.to_s
    subject = strip_tags(subject) unless subject.html_safe?
    mail(:to => receiver.send(Mailboxer.email_method,message), :subject => t('mailboxer.message_mailer.subject_reply', :subject => subject)) do |format|
      format.text {render __method__}
      format.html {render __method__}
    end
  end
end

我在我的语言环境中有这个:

da:
  mailboxer:
    message_mailer:
        subject_reply: You have got a new reply "#{subject}"

而不是覆盖电子邮件方法。不能在 YAML 文件中做一些 ruby​​ 代码吗?现在,电子邮件的主题只是您收到了一个新的回复“#{subject}”作为文本,并且 ruby​​ 代码未激活。

4

1 回答 1

5

Rails 的翻译文件不允许使用 Ruby,但它们确实具有插值机制。尝试:

subject_reply: "You have got a new reply %{subject}"

有关详细信息,请参阅http://guides.rubyonrails.org/i18n.html#passing-variables-to-translations 。

于 2012-11-07T20:42:37.270 回答