Module: RailsI18nUpdater
- Defined in:
- lib/rails_i18n_updater.rb,
lib/rails_i18n_updater/config.rb,
lib/rails_i18n_updater/railtie.rb
Defined Under Namespace
Class Method Summary collapse
-
.prepare_i18n_load_path ⇒ Object
Prepare load path: add Rails core locales to I18n.load_path - only add locales that are actually used in the application - prepend locales so that they can be overwritten by the application.
Class Method Details
.prepare_i18n_load_path ⇒ Object
Prepare load path: add Rails core locales to I18n.load_path
-
only add locales that are actually used in the application
-
prepend locales so that they can be overwritten by the application
9 10 11 12 13 |
# File 'lib/rails_i18n_updater.rb', line 9 def self.prepare_i18n_load_path used_locales = I18n.load_path.map { |f| File.basename(f).gsub(/\.(rb|yml)$/, '') }.uniq files_to_add = Dir[File.join(RailsI18nUpdater::Config.local_path, '**', "{#{used_locales.join(',')}}.{rb,yml}")] I18n.load_path.unshift(*files_to_add) end |