0
我正在完成我的网站的不同本地化,我在设计电子邮件模板中遇到了一个小问题。设计 - 如何翻译自动生成的链接
在例如确认电子邮件,我已经翻译了这一切,但链接确认帐户中生成使用这个片段汽车:
<%= link_to t('devise.mailer.confirmation_instructions.confirm_link'), confirmation_url(@resource, :confirmation_token => @token) %>
这个自动生成的总是链接指向我的.COM网页版和我希望它是有条件的取决于域(.com/.es)。当链接是不会产生我可以做到,使用汽车:
if request.host.split('.').last == "com"
或
if request.host.split('.').last == "es"
但在这种情况下,我不知道我能做到这一点。
有什么建议吗?
谢谢。主机参数去你confirmation_url(@resource,:confirmation_token => @token)
您是否以某种方式为用户存储当前的语言设置? – Bartosz
您可以将':host'参数传递给'url'帮助器。 – Bartosz
我在用户表中存储了一列,用于存储用户浏览器的语言。我怎么能通过:主机参数? <%= link_to t('devise.mailer.confirmation_instructions.confirm_link'),confirmation_url(@resource,:confirmation_token => @token,:host =>'www.example.com')%>这种方式? –