【发布时间】:2010-06-22 13:39:18
【问题描述】:
当 Rails 函数要求翻译 (I18n.translate) 时,我不想分析它们的代码以获得确切的范围等。
如何在控制台中为每个请求的字符串添加调试输出?
示例:
I18n.t 'errors.messages.invalid', :scope => :active_record
# Translation for 'activerecord.errors.messages.invalid' (not) found
label(:post, :title)
# Translation for 'activerecord.attributes.post.title' not found
# Translation for 'views.labels.post.title' not found
【问题讨论】:
-
到目前为止,我没有比“阅读 Rails 代码”或“使用您自己的翻译字符串”(如第一个示例)更好的答案了。
标签: ruby-on-rails debugging internationalization