Skip to content

Commit

Permalink
WIP attempt to fix locale loading
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Aug 19, 2021
1 parent 54f5575 commit a089115
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
20 changes: 19 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,25 @@ class Application < Rails::Application
config.action_mailer.default_url_options[:protocol] = "https"
end

config.after_initialize do
config.before_initialize do
require 'i18n_fixes.rb'
require 'alaveteli_localization'

paths = ['locale']
paths << 'locale_alaveteli_pro' if AlaveteliConfiguration.
enable_alaveteli_pro

repos = paths.map do |path|
FastGettext::TranslationRepository.build('app', path: path, type: :po)
end
AlaveteliLocalization.set_default_text_domain('app', repos)

I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)

AlaveteliLocalization.set_default_locale_urls(
AlaveteliConfiguration.include_default_locale_in_urls
)

AlaveteliLocalization.set_locales(
AlaveteliConfiguration.available_locales,
AlaveteliConfiguration.default_locale
Expand Down
3 changes: 0 additions & 3 deletions config/initializers/alaveteli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,17 @@
require 'core_ext/warning'

require 'use_spans_for_errors.rb'
require 'i18n_fixes.rb'
require 'world_foi_websites.rb'
require 'alaveteli_external_command.rb'
require 'quiet_opener.rb'
require 'mail_handler'
require 'ability'
require 'normalize_string'
require 'alaveteli_file_types'
require 'alaveteli_localization'
require 'theme'
require 'xapian_queries'
require 'date_quarter'
require 'public_body_csv'
require 'routing_filters'
require 'alaveteli_text_masker'
require 'database_collation'
require 'alaveteli_geoip'
Expand Down
16 changes: 0 additions & 16 deletions config/initializers/fast_gettext.rb

This file was deleted.

1 change: 1 addition & 0 deletions lib/alaveteli_localization.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'alaveteli_localization/locale'
require 'alaveteli_localization/hyphenated_locale'
require 'alaveteli_localization/underscorred_locale'
require 'routing_filters'

class AlaveteliLocalization
class << self
Expand Down

0 comments on commit a089115

Please sign in to comment.