如何使用语言环境添加翻译?

Erw*_*ers 1 ruby ruby-on-rails spree

在 config/locales/en.yml 我有以下行:

en:
  hello: "Hello world"
  home: "Home"
  about: "About"
Run Code Online (Sandbox Code Playgroud)

在一个链接中,我有这个代码:

<li id="about-link" data-hook><%= link_to Spree.t(:about), spree.root_path%></li>
Run Code Online (Sandbox Code Playgroud)

当我启动服务器并转到网页并将鼠标悬停在关于链接上时,我看到以下替代文本:

translation missing en.spree.about
Run Code Online (Sandbox Code Playgroud)

为什么缺少翻译?

Sur*_*rya 5

您的语言环境应如下所示:

en:
  spree:
    hello: "Hello world"
    home: "Home"
    about: "About"
Run Code Online (Sandbox Code Playgroud)

从那时起,spree 就Spree为所有 I18n.t 调用进行了自己的国际化设置。所以,上面定义的约定应该有效。