"Fossies" - the Fresh Open Source Software Archive

Member "discourse-2.8.3/config/initializers/100-i18n.rb" (14 Apr 2022, 703 Bytes) of package /linux/www/discourse-2.8.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 # frozen_string_literal: true
    2 
    3 # order: after 02-freedom_patches.rb
    4 
    5 require 'i18n/backend/discourse_i18n'
    6 require 'i18n/backend/fallback_locale_list'
    7 
    8 # Requires the `translate_accelerator.rb` freedom patch to be loaded
    9 Rails.application.reloader.to_prepare do
   10   I18n.backend = I18n::Backend::DiscourseI18n.new
   11   I18n.fallbacks = I18n::Backend::FallbackLocaleList.new
   12   I18n.config.missing_interpolation_argument_handler = proc { throw(:exception) }
   13   I18n.reload!
   14   I18n.init_accelerator!(overrides_enabled: ENV['DISABLE_TRANSLATION_OVERRIDES'] != '1')
   15 
   16   unless Rails.env.test?
   17     MessageBus.subscribe("/i18n-flush") do
   18       I18n.reload!
   19       ExtraLocalesController.clear_cache!
   20     end
   21   end
   22 end