错误I18n :: InvalidLocaleData [英] Error I18n::InvalidLocaleData

查看:175
本文介绍了错误I18n :: InvalidLocaleData的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用I18n,我已经按照railscast的方法进行操作,但是事情变得疯狂了,我不知道错误在哪里,尝试过检查格式,尝试了几种方法,但仍然不能完成.

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.

我的 en.yml

my en.yml

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

我的 view

my view

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

但是返回I18n::InvalidLocaleData in Categories#indexcan not load translations from /home/lenovo/cost_control/config/locales/en.yml, expected it to return a hash, but does not

我刚刚尝试了 en.yml :

I had try on my en.yml just:

en:
  title: "Listing Categories"

并且可以完美地工作,但是当我添加更多行时,只需将这些错误返回给我即可.抱歉,我还没那么先进,谢谢你们:D的帮助.

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.

推荐答案

您的YAML似乎已损坏.您不是使用制表符代替空格吗?

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

您可以使用 YAMLlint 检查YAML的有效性.

You can use YAMLlint to check YAML for validity.

这篇关于错误I18n :: InvalidLocaleData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆