6

I want use I18n and I already follow on how to do that from railscast but the thing gone wild and I don't know where the mistake, had tried check the format, tried several ways but still can't be done.

my en.yml

en:
  category:
    index:
      title: "Listing Categories"
      name: "Name"
      is_active: "Is Active"

my view

<%= t 'category.index.title' %>

But return I18n::InvalidLocaleData in Categories#index and can not load translations from /home/lenovo/cost_control/config/locales/en.yml, expected it to return a hash, but does not

I had try on my en.yml just:

en:
  title: "Listing Categories"

and can work perfectly, but when I adding more line, just return me those error. I'm sorry I just not so advanced yet in rails, thank you for the help you guys :D really.

4

2 に答える 2

28

YAMLが壊れているようです。スペースの代わりにタブを使用しませんでしたか?

YAMLlintを使用して、YAMLの有効性を確認できます。

于 2013-03-11T06:26:19.057 に答える
0

Ilyaが推奨するバリデーターは、かなり基本的で、それほど優れていないように見えました

https://codebeautify.org/yaml-validatorより良いこれを見つけました

于 2019-07-04T07:47:30.173 に答える