LoginSignup
0
0

More than 5 years have passed since last update.

rails locale設定の自動ロード

Posted at

参考資料: http://api.rubyonrails.org/classes/ActiveSupport/FileUpdateChecker.html

ファイルconfig/initializers/locale_yml_reloader.rbを作成し、中身は下記ようにする。

if Rails.env.development?
  locale_yml_reloader = ActiveSupport::FileUpdateChecker.new(Dir["config/locales/**/*yml"]) do
     I18n.reload!
  end

  ActiveSupport::Reloader.to_prepare do
    locale_yml_reloader.execute_if_updated
  end
end

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0