<commit_before>require 'yajl'
require 'state_machine'
require 'state_machine_job'
require 'paperclip'
require 'aws-sdk'
require 'friendly_id'
require 'devise'
require 'cancan'
require 'jbuilder'
require 'htmlentities'
require 'kramdown'
require 'react-rails'

require 'resque_mailer'
require 'resque_scheduler'

require 'active_admin'
require 'activeadmin-searchable_select'

require 'jquery-layout-rails'
require 'backbone-rails'
require 'marionette-rails'
require 'jquery-fileupload-rails'
require 'jquery-minicolors-rails'
require 'wysihtml5x/rails'
require 'i18n-js'
require 'http_accept_language'
require 'pageflow-public-i18n'

if Gem::Specification.find_all_by_name('pageflow-react', '>= 0.0').any?
  fail('The pageflow-react gem has been merged into the pageflow gem. ' \
       'See the pageflow changelog for update instructions.')
end

module Pageflow
  # Rails integration
  class Engine < ::Rails::Engine
    isolate_namespace Pageflow

    config.autoload_paths << File.join(config.root, 'lib')
    config.autoload_paths << File.join(config.root, 'app', 'views', 'components')

    config.i18n.load_path += Dir[config.root.join('config', 'locales', '**', '*.yml').to_s]
    config.i18n.available_locales = [:en, :de] | PublicI18n.available_locales
    config.i18n.default_locale = :en

    # Supress deprecation warning. This is the future default value of the option.
    I18n.config.enforce_available_locales = true

    # FORCE RAILS TO MAKE I18N AVAILABLE TO ACTIVE ADMIN
    config.before_configuration do
      I18n.load_path += Dir[Engine.root.join('config', 'locales', '**', '*.yml').to_s]
      I18n.locale = :en
      I18n.default_locale = :en
      config.i18n.load_path += Dir[Engine.root.join('config', 'locales', '**', '*.yml').to_s]
      config.i18n.locale = :en
      # bypasses rails bug with i18n in production
      I18n.reload!
      config.i18n.reload!
    end

    # Make sure the configuration is recreated when classes are
    # reloded. Otherwise registered page types might still point to
    # unloaded classes in development mode.
    config.to_prepare do
      Pageflow.configure!
    end

    initializer "pageflow.factories", :after => "factory_girl.set_factory_paths" do
      if Pageflow.configured? && defined?(FactoryGirl)
        FactoryGirl.definition_file_paths.unshift(Engine.root.join('spec', 'factories'))
      end
    end
<commit_msg>Disable i18n reload that raises exception<commit_after>require 'yajl'
require 'state_machine'
require 'state_machine_job'
require 'paperclip'
require 'aws-sdk'
require 'friendly_id'
require 'devise'
require 'cancan'
require 'jbuilder'
require 'htmlentities'
require 'kramdown'
require 'react-rails'

require 'resque_mailer'
require 'resque_scheduler'

require 'active_admin'
require 'activeadmin-searchable_select'

require 'jquery-layout-rails'
require 'backbone-rails'
require 'marionette-rails'
require 'jquery-fileupload-rails'
require 'jquery-minicolors-rails'
require 'wysihtml5x/rails'
require 'i18n-js'
require 'http_accept_language'
require 'pageflow-public-i18n'

if Gem::Specification.find_all_by_name('pageflow-react', '>= 0.0').any?
  fail('The pageflow-react gem has been merged into the pageflow gem. ' \
       'See the pageflow changelog for update instructions.')
end

module Pageflow
  # Rails integration
  class Engine < ::Rails::Engine
    isolate_namespace Pageflow

    config.autoload_paths << File.join(config.root, 'lib')
    config.autoload_paths << File.join(config.root, 'app', 'views', 'components')

    config.i18n.load_path += Dir[config.root.join('config', 'locales', '**', '*.yml').to_s]
    config.i18n.available_locales = [:en, :de] | PublicI18n.available_locales
    config.i18n.default_locale = :en

    # Supress deprecation warning. This is the future default value of the option.
    I18n.config.enforce_available_locales = true

    # FORCE RAILS TO MAKE I18N AVAILABLE TO ACTIVE ADMIN
    config.before_configuration do
      I18n.load_path += Dir[Engine.root.join('config', 'locales', '**', '*.yml').to_s]
      I18n.locale = :en
      I18n.default_locale = :en
      config.i18n.load_path += Dir[Engine.root.join('config', 'locales', '**', '*.yml').to_s]
      config.i18n.locale = :en
    end

    # Make sure the configuration is recreated when classes are
    # reloded. Otherwise registered page types might still point to
    # unloaded classes in development mode.
    config.to_prepare do
      Pageflow.configure!
    end

    initializer "pageflow.factories", :after => "factory_girl.set_factory_paths" do
      if Pageflow.configured? && defined?(FactoryGirl)
        FactoryGirl.definition_file_paths.unshift(Engine.root.join('spec', 'factories'))
      end
    end

{'fraction_non_alphanumeric': 0.11704834605597965, 'fraction_numerical': 0.013994910941475827, 'mean_word_length': 4.2940516273849605, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4000800', 'n_tokens_mistral': 1606, 'n_tokens_neox': 1530, 'n_words': 368}