Module: Clean::Locales

Defined in:
lib/clean/locales.rb

Defined Under Namespace

Classes: Scrutator, Translation

Class Method Summary collapse

Class Method Details

.run!(reference = nil) ⇒ Object


760
761
762
763
764
765
766
767
768
769
770
771
# File 'lib/clean/locales.rb', line 760

def self.run!(reference = nil)
  Clean::Support.set_search_path!
  reference ||= I18n.default_locale
  log = File.open(Rails.root.join('log', 'clean-locales.log'), 'wb')
  Translation.new(reference, log: log).clean!
  locales = ::I18n.available_locales.delete_if do |l|
    l == reference || l.to_s.size != 3
  end.sort_by(&:to_s)
  locales.each do |locale|
    Translation.new(locale, log: log).clean_from!(reference)
  end
end