gem http_accept_language installed and (de)activable with feature flag

This commit is contained in:
Judith 2020-08-27 11:37:03 +02:00 committed by Pierre de La Morinerie
parent ea16e71a8d
commit af25fdd77c
4 changed files with 13 additions and 3 deletions

View file

@ -19,6 +19,7 @@ class ApplicationController < ActionController::Base
before_action :set_active_storage_host
before_action :setup_javascript_settings
before_action :setup_tracking
before_action :set_locale
helper_method :multiple_devise_profile_connect?, :instructeur_signed_in?, :current_instructeur,
:administrateur_signed_in?, :current_administrateur, :current_account
@ -299,4 +300,10 @@ class ApplicationController < ActionController::Base
def current_email
current_user&.email
end
def set_locale
if feature_enabled?(:localization)
I18n.locale = http_accept_language.compatible_language_from(I18n.available_locales)
end
end
end