开发者

Ruby on Rails Internationalization

Hey, I try to make my config/locals organized in directories like the app directory. I can not get this to work... Here http://guides.rubyonrails.org/i18n.html says you have to activate this manually under config like this

config.i18n.load_path += Dir[File.join(RAILS_ROOT, 'config', 'locales', '**', '*.{rb,yml}')] 

but when I 开发者_运维技巧try to use my constant in a view a get an error (missing/nil). Can someone write an example step by step? 10thx!


Found the solution. I found out I did everything right :).

You have to add this

config.i18n.load_path += Dir[File.join(RAILS_ROOT, 'config', 'locales', '**', '*.{rb,yml}')]

to the config/locales/environment.rb and then you can use whatever directory structure you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜