Sha256: fd4a2fd53bc55b1b00c908174979e679ed7e6dd62f88a9e9b5ef21e717a5037c

Contents?: true

Size: 896 Bytes

Versions: 19

Compression:

Stored size: 896 Bytes

Contents

# frozen_string_literal: true

require 'i18n/backend/active_record'
require 'i18n/backend/fallbacks'

ActiveSupport::Reloader.to_prepare do
  # Don't allow initializer to break if DB doesn't exist yet
  # see: https://github.com/projectblacklight/spotlight/issues/2133
  if ENV['SKIP_TRANSLATION'].blank?
    raise unless Translation.table_exists?

    ##
    # Sets up the new Spotlight Translation backend, backed by ActiveRecord. To
    # turn on the ActiveRecord backend, uncomment the following lines.
    I18n.backend = I18n::Backend::ActiveRecord.new
    I18n::Backend::ActiveRecord.include I18n::Backend::Memoize
    I18n::Backend::Simple.include I18n::Backend::Memoize
    I18n::Backend::Simple.include I18n::Backend::Pluralization
    I18n::Backend::Simple.include I18n::Backend::Fallbacks

    I18n.backend = I18n::Backend::Chain.new(I18n.backend, I18n::Backend::Simple.new)
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
blacklight-spotlight-3.5.0.4 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.6.0.beta7 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.5.0.3 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.6.0.beta6 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.6.0.beta5 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.6.0.beta4 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.6.0.beta3 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.6.0.beta1 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.5.0.2 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.5.0.1 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.5.0 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.4.4.1 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.4.4 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.4.3 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.4.2.2 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.4.2.1 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.4.2 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.4.1 lib/generators/spotlight/templates/config/initializers/translation.rb
blacklight-spotlight-3.4.0 lib/generators/spotlight/templates/config/initializers/translation.rb