【发布时间】:2014-04-21 20:54:51
【问题描述】:
我有这个完美运行的简单 erb 代码,与我的 i18n.yml 文件相连。这个想法是获取客户端的edit.html.erb 页面,在我的en.yml 文件中获取该页面的标题并将该标题传递给@client.fullname 变量。像这样:
<h1><%= t('client.edit.title'), :current_client => @client.fullname %></h1>
现在,我正在将我的 erb 文件转换为 slim。所以那行代码的结果是
h1 = t('client.edit.title'), :current_client => @client.fullname
但它不会将变量传递给en.yml 文件。相反,它会抛出此错误:
/app/views/clients/edit.html.slim:1: syntax error, unexpected ',', expecting ')' ...tty2 = (t('client.edit.title'), :current_client => @client.f... ... ^
有人知道我在这里做错了什么吗?
【问题讨论】:
-
我可以使它相对工作的唯一方法是传递带有翻译标识符字符串的 :current_client 选项: = t('client.edit.title', :current_client => @client.fullname)
-
谢谢,你也明白了!