Rails 3 i18n“翻译”方法翻译正确但显示“翻译缺失”
我正在运行 Rails 3.0.9
我有这个:
<%= t time_ago_in_words(i.created_at) %>
它打印:
<span title="translation missing: pt-BR.2 minutos" class="translation_missing">2 Minutos</span>
翻译工作但“翻译丢失”不断出现。有人知道为什么吗?
我使用这里的rails-i18n pt-BR.yml: https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/pt-BR.yml
在我的application.rb:
config.i18n.default_locale = "pt-BR"
即使我从 aplication.rb 中删除上面的行,“翻译丢失”仍然会出现!
它让人抓狂。 =[
I'm running Rails 3.0.9
I have this:
<%= t time_ago_in_words(i.created_at) %>
And it prints:
<span title="translation missing: pt-BR.2 minutos" class="translation_missing">2 Minutos</span>
The translations is working but the "translation missing" keeps showing up. Does anybody know why?
I'm using the rails-i18n pt-BR.yml from here: https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/pt-BR.yml
And in my application.rb:
config.i18n.default_locale = "pt-BR"
Even if I remove the line above from aplication.rb the "translation missing" keeps showing up!
It is making crazy. =[
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
翻译已由
time_ago_in_words
帮助程序处理,返回“2 分钟”。您不需要再次将结果传递回t
方法。当您对已翻译的字符串调用t
时,i18n 会将其视为键并尝试再次查找它。The translation is already being handled by the
time_ago_in_words
helper, returning "2 minutos". You don't need to pass the result back to thet
method again. When you callt
on the already translated string, i18n is treating it as a key and trying to look it up again.