但一开始我得到一个错误:
I18n::InvalidLocaleData in Users#index
Showing .../app/views/users/index.html.erb where line #1 raised:
can not load translations from .../config/locales/en.yml, expected it to return a hash, but does not
index.html.erb:
<% provide(:title, t('users.index.title.site_title')) %>
<h1><%= t 'users.index.title.head' %></h1>
<%= form_tag users_path, :method => 'get' do %>
<%= hidden_field_tag :direction, params[:direction] %>
<%= hidden_field_tag :sort, params[:sort] %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag (t 'users.index.search_form.search'), :name => nil %>
</p>
<% end %>
配置/语言环境/en.yml
en:
users:
index:
title:
site_title: "Users"
head: "Users"
search_form:
search: "Search"