diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b398d5420..e070d438c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -133,7 +133,14 @@ def has_access? def set_locale store_locale_to_cookie(params[:locale]) if locale - I18n.locale = cookies[:locale] || I18n.default_locale + I18n.locale = locale_value + end + + def locale_value + return I18n.default_locale unless cookies[:locale].present? + return I18n.default_locale unless I18n.available_locales.include?(cookies[:locale].to_sym) + + cookies[:locale] end def user_not_authorized