将 I18n 与 HTML 标签和符号一起使用
# config/locales/en.yml
en:
stackoverflow:
header:
title_html: "Use <strong>I18n</strong> with Tags & Symbols"
注意在名称 title
之后添加额外的 _html
。
在视图中,
# ERB
<h2><%= t(:title_html, scope: [:stackoverflow, :header]) %></h2>