Sha256: a9f46a00d0dc7a54689d8ccf395211ecaf918c74d329f552a2f5821472d8119e

Contents?: true

Size: 785 Bytes

Versions: 4

Compression:

Stored size: 785 Bytes

Contents

require 'i18n/backend/active_record'
require 'interpret/logger'
require 'interpret/helpers'

module Interpret
  class Engine < Rails::Engine
    if Interpret.registered_envs.include?(Rails.env.to_sym)
      initializer "interpret.register_i18n_active_record_backend" do |app|
        I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Memoize)
        I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Flatten)

        Interpret.backend = I18n::Backend::ActiveRecord.new
        app.config.i18n.backend = Interpret.backend
      end
    end

    initializer "interpret.setup_translations_logger" do |app|
      logfile = File.open("#{Rails.root}/log/interpret.log", 'a')
      logfile.sync = true
      Interpret.logger = InterpretLogger.new(logfile)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
interpret-0.1.4 lib/interpret/engine.rb
interpret-0.1.3 lib/interpret/engine.rb
interpret-0.1.2 lib/interpret/engine.rb
interpret-0.1.1 lib/interpret/engine.rb