如何在视图中启用Rails I18n翻译错误? [英] How to enable Rails I18n translation errors in views?
问题描述
我创建了一个新的Rails 3项目.我尝试在这样的视图中使用翻译:
I created new Rails 3 project. I try to use translations in my views like this:
= t('.translate_test')
在我的浏览器中,我看起来是"translate_test"
而不是我在 en.yml 中设置的"my test translation"
女巫.
In my browser i looks "translate_test"
instead "my test translation"
witch i set in en.yml.
我的主要问题-为什么我看不到像"Missing translation: en ..."
这样的错误?
My main question - why i can't see error like "Missing translation: en ..."
?
推荐答案
在Rails 3中,它们不再向您显示此文本.如果您检查html源代码中的元素,则会看到翻译缺失消息.
In Rails 3 they don't show you this text anymore. If you inspect the element in the html source you will see the translation missing message.
您可以关闭后备功能,尝试将以下内容放入您的环境或初始化程序中:
You can turn fallbacks off, try to put in your environment or an initializer the following:
config.i18n.fallbacks = false
这篇关于如何在视图中启用Rails I18n翻译错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!