Error I18n :: InvalidLocaleData

I want to use I18n, and I'm already talking about how to do it with railscast , but the thing disappeared, and I donโ€™t know where the error is, I tried to check the format, I tried several ways, but it still could not 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 tried only en.yml :

 en: title: "Listing Categories" 

and may work just fine, but when I add more lines, just return this error to me. I'm sorry that I have not yet advanced so much in rails, thanks for helping you guys: D really.

+4
source share
2 answers

It seems your NML is broken. Didn't you use tabs instead of spaces?

You can use YAMLlint to check for authenticity of YAML.

+25
source

The validator Ilya recommends looked pretty simple and not very good

Found this one that is better https://codebeautify.org/yaml-validator

0
source

All Articles