Unable to use I18n.t call in an initializer file

强颜欢笑 提交于 2019-12-11 23:19:17

问题


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.

Are there any workarounds ?

Thanks


回答1:


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.



来源:https://stackoverflow.com/questions/3514536/unable-to-use-i18n-t-call-in-an-initializer-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!