Sha256: 57062e107d23710bcee8b8833c8cc56667d44bec9872a1aabf7c3f913da5791b

Contents?: true

Size: 654 Bytes

Versions: 30

Compression:

Stored size: 654 Bytes

Contents

require 'rails'

module DeviseI18n
  # This adds the views to view path
  class Engine < ::Rails::Engine
  end

  class Railtie < ::Rails::Railtie #:nodoc:
    initializer 'devise-i18n' do |app|
      DeviseI18n::Railtie.instance_eval do
        pattern = pattern_from app.config.i18n.available_locales

        add("rails/locales/#{pattern}.yml")
      end
    end

    protected

    def self.add(pattern)
      files = Dir[File.join(File.dirname(__FILE__), '../..', pattern)]
      I18n.load_path.concat(files)
    end

    def self.pattern_from(args)
      array = Array(args || [])
      array.blank? ? '*' : "{#{array.join ','}}"
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
devise-i18n-1.6.0 lib/devise-i18n/railtie.rb
devise-i18n-1.5.1 lib/devise-i18n/railtie.rb
devise-i18n-1.5.0 lib/devise-i18n/railtie.rb
devise-i18n-1.4.0 lib/devise-i18n/railtie.rb
devise-i18n-1.2.0 lib/devise-i18n/railtie.rb
devise-i18n-1.1.2 lib/devise-i18n/railtie.rb
devise-i18n-1.1.1 lib/devise-i18n/railtie.rb
devise-i18n-1.1.0 lib/devise-i18n/railtie.rb
devise-i18n-1.0.1 lib/devise-i18n/railtie.rb
devise-i18n-1.0.0 lib/devise-i18n/railtie.rb