无法在初始化文件中使用I18n.t调用 [英] Unable to use I18n.t call in an initializer file

查看:329
本文介绍了无法在初始化文件中使用I18n.t调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在初始化文件中使用I18n.t调用. 不幸的是,它不起作用. Rails返回通常的翻译缺失:"消息. 拨打电话时似乎尚未加载I18n文件.

I would like to use I18n.t call in an initializer file. Unfortunately, it doesn't work. Rails returns the usual "translation missing:" message. It seems that the I18n files haven't been loaded yet when the call is made.

有没有解决方法?

谢谢

推荐答案

我在使用Rails 2.3.2时遇到了问题. 从那时起,我已经迁移到2.3.5,并且I18n.t调用在初始化程序中可以正常工作.

I had the problem when I was using Rails 2.3.2. Since then, I've migrated to 2.3.5 and I18n.t calls work fine in my initializers.

这篇关于无法在初始化文件中使用I18n.t调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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