5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 01:41:42 +00:00

fix: no permitir idiomas que no existen en el cambio de idioma #13493
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
f 2023-05-24 10:06:11 -03:00
parent e35bddf915
commit 4e002e042b

View file

@ -59,7 +59,11 @@ class ApplicationController < ActionController::Base
#
# @return [String,Symbol]
def current_locale
session[:locale] = params[:change_locale_to] if params[:change_locale_to].present?
locale = params[:change_locale_to]
if locale.present? && I18n.locale_available?(locale)
session[:locale] = params[:change_locale_to]
end
session[:locale] || current_usuarie&.lang || I18n.locale
end