如何在 rails 中使用 <%= t('vote.up') %> 获取 <a> 标签标题的整个句子?
How to get the whole sentence for title of <a> tag using <%= t('vote.up') %> in rails?
在en.yml、vote.up = "This question does not show any research effort; it is unclear or not useful"
当我写:
<a href="#" title=<%= t('vote.up') %> ><i class="icon-arrow-down"></i></a>
我得到 HTML:
<a href="#" title="This" question="" does="" not="" show="" any="" research="" effort;="" it="" is="" unclear="" or="" useful=""><i class="icon-arrow-down"></i></a>
但我希望得到:
<a href="#" title="This question does not show any research effort; it is unclear or not useful"><i class="icon-arrow-up"></i></a>
我该怎么办?提前致谢!
用双引号将 title
的 html 属性值括起来:
title="<%= t('vote.up') %>"
在en.yml、vote.up = "This question does not show any research effort; it is unclear or not useful"
当我写:
<a href="#" title=<%= t('vote.up') %> ><i class="icon-arrow-down"></i></a>
我得到 HTML:
<a href="#" title="This" question="" does="" not="" show="" any="" research="" effort;="" it="" is="" unclear="" or="" useful=""><i class="icon-arrow-down"></i></a>
但我希望得到:
<a href="#" title="This question does not show any research effort; it is unclear or not useful"><i class="icon-arrow-up"></i></a>
我该怎么办?提前致谢!
用双引号将 title
的 html 属性值括起来:
title="<%= t('vote.up') %>"