將 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>