# class I18n::Railtie

### Public Class Methods

reloader() click to toggle source

    # File lib/active_support/i18n_railtie.rb, line 12
    def self.reloader
      @reloader ||= ActiveSupport::FileUpdateChecker.new(reloader_paths){ I18n.reload! }
    end

reloader_paths() click to toggle source

    # File lib/active_support/i18n_railtie.rb, line 16
    def self.reloader_paths
      @reloader_paths ||= []
    end

### Protected Class Methods

include_fallbacks_module() click to toggle source

    # File lib/active_support/i18n_railtie.rb, line 72
    def self.include_fallbacks_module
      I18n.backend.class.send(:include, I18n::Backend::Fallbacks)
    end

init_fallbacks(fallbacks) click to toggle source

    # File lib/active_support/i18n_railtie.rb, line 76
    def self.init_fallbacks(fallbacks)
      include_fallbacks_module

      args = case fallbacks
      when ActiveSupport::OrderedOptions
        [*(fallbacks[:defaults] || []) << fallbacks[:map]].compact
      when Hash, Array
        Array.wrap(fallbacks)
      else # TrueClass
        []
      end

      I18n.fallbacks = I18n::Locale::Fallbacks.new(*args)
    end

initialize_i18n(app) click to toggle source

Setup i18n configuration

    # File lib/active_support/i18n_railtie.rb, line 48
    def self.initialize_i18n(app)
      return if @i18n_inited

      fallbacks = app.config.i18n.delete(:fallbacks)

      app.config.i18n.each do |setting, value|
        case setting
        when :railties_load_path
          app.config.i18n.load_path.unshift(*value)
        when :load_path
          I18n.load_path += value
        else
          I18n.send("#{setting}=", value)
        end
      end

      init_fallbacks(fallbacks) if fallbacks && validate_fallbacks(fallbacks)

      reloader_paths.concat I18n.load_path
      reloader.execute

      @i18n_inited = true
    end

validate_fallbacks(fallbacks) click to toggle source

    # File lib/active_support/i18n_railtie.rb, line 91
    def self.validate_fallbacks(fallbacks)
      case fallbacks
      when ActiveSupport::OrderedOptions
        !fallbacks.empty?
      when TrueClass, Array, Hash
        true
      else
        raise "Unexpected fallback type #{fallbacks.inspect}"
      end
    end