We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5fe4a0e + 75d38b7 commit f7ea200Copy full SHA for f7ea200
1 file changed
app/controllers/application_controller.rb
@@ -138,7 +138,14 @@ def admin_namespace?
138
139
def set_locale
140
store_locale_to_cookie(params[:locale]) if locale
141
- I18n.locale = cookies[:locale] || I18n.default_locale
+ I18n.locale = locale_value
142
+ end
143
+
144
+ def locale_value
145
+ return I18n.default_locale unless cookies[:locale].present?
146
+ return I18n.default_locale unless I18n.available_locales.include?(cookies[:locale].to_sym)
147
148
+ cookies[:locale]
149
end
150
151
def user_not_authorized
0 commit comments