obey the dog
This commit is contained in:
parent
fc62e2ddb2
commit
ebcf9d7676
|
@ -11,8 +11,8 @@ class ApplicationController < ActionController::Base
|
||||||
before_action :find_active_announcements
|
before_action :find_active_announcements
|
||||||
|
|
||||||
# check if user wants to read
|
# check if user wants to read
|
||||||
def switch_locale(&action)
|
def switch_locale(&) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
||||||
return I18n.with_locale("en", &action) if Rails.env.test?
|
return I18n.with_locale("en", &) if Rails.env.test?
|
||||||
|
|
||||||
locale = params[:lang] || current_user&.locale || cookies[:lang] || "en"
|
locale = params[:lang] || current_user&.locale || cookies[:lang] || "en"
|
||||||
if params[:lang] && current_user.present?
|
if params[:lang] && current_user.present?
|
||||||
|
@ -22,7 +22,7 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
cookies[:lang] = locale
|
cookies[:lang] = locale
|
||||||
|
|
||||||
I18n.with_locale(locale, &action)
|
I18n.with_locale(locale, &)
|
||||||
end
|
end
|
||||||
|
|
||||||
# check if user got hit by the banhammer of doom
|
# check if user got hit by the banhammer of doom
|
||||||
|
|
Loading…
Reference in New Issue