heroku 未加载语言文件 [英] heroku not loading language file

查看:89
本文介绍了heroku 未加载语言文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Heroku 似乎没有加载 config/locales/pt.yml.(语言已正确设置为 pt.)

Heroku does not seem to be loading config/locales/pt.yml. (Language is being set correctly to pt.)

I18n 在本地主机上运行良好,但在 我的 heroku 服务器上却没有.
代码位于 https://github.com/aneves/deficit-puzzle

I18n is working perfectly on localhost, but not on my heroku server.
Code is at https://github.com/aneves/deficit-puzzle

本地主机:

$ rails console
Loading development environment (Rails 3.0.5)
irb(main):001:0> I18n.t(:Edit)
=> "Editar"

heroku:

$ heroku console
Ruby console for deficit-puzzle.heroku.com
>> I18n.t(:Edit)
=> "translation missing: pt.Edit"

可能的重复:

我的问题有很多匹配项,但这些都是死线程.我不想在 OP 未回答评论的线程上开赏金,我宁愿有一个很好的问题并有很好的跟进.此外,这些问题没有准确指出问题,因此,答案没有抓住要点.

possible dups:

There are SO matches for my problem, but those are dead threads. I do not want to open a bounty on a thread whose OP left comments unanswered, I'd rather have a good question with good follow up. Also, the questions do not pinpoint the problem accurately and, so, the answers miss the point.

  1. 一个没有答案,OP也没有跟进评论;
  2. 另一个只有一个没有抓住重点的答案,OP没有跟上最后一条评论.
  1. One has no answer and OP did not follow up on comments;
  2. Another has only an answer that misses the point, and OP does not follow up on the last comment either.

推荐答案

奇怪的是,数据按预期出现在 I18n.backend 中,但无法使用 I18n.t 单独选择>

Curiously, data were appearing in I18n.backend as expected but were not individually selectable using I18n.t

这导致意识到必须正确配置加载路径才能让 Rails 找到翻译文件,但它没有正确解析它们.

This led to the realization that the load path must be configured correctly for Rails to find the translation files, but that it was not parsing them properly.

导致@ANeves 发现BOM 破坏了 Heroku 解析文件的能力,这些文件导致修复删除有问题的 BOM.

This led to @ANeves discovering that a BOM was disrupting Heroku's ability to parse the files which resulted in the fix of removing the offending BOM.

Unicode 标准 确实允许使用 UTF-8 格式的 BOM,但是 没有要求或推荐使用.字节顺序 在UTF-8 因此在 UTF-8 中,BOM 仅用于标识文本流或文件为 UTF-8.

The Unicode Standard does permit the BOM in UTF-8, but does not require or recommend its use. Byte order has no meaning in UTF-8 so in UTF-8 the BOM serves only to identify a text stream or file as UTF-8.

许多 Windows 程序(包括 Windows 记事本)添加 BOM默认为 UTF-8 文件.

Many Windows programs (including Windows Notepad) add BOMs to UTF-8 files by default.

如果未来的读者正在使用 考虑阅读常见的编码问题.

If future readers are on ruby-1.9 consider reading about common encoding problems.

这篇关于heroku 未加载语言文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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