app/controllers/spree/admin/locale_controller.rb in solidus_backend-4.2.4 vs app/controllers/spree/admin/locale_controller.rb in solidus_backend-4.3.0
- old
+ new
@@ -9,12 +9,18 @@
requested_locale = params[:switch_to_locale].to_s.presence
if locale_is_available?(requested_locale)
I18n.locale = requested_locale
session[set_user_language_locale_key] = requested_locale
- render json: { locale: requested_locale, location: spree.admin_url }
+ respond_to do |format|
+ format.json { render json: { locale: requested_locale, location: spree.admin_url } }
+ format.html { redirect_back_or_to spree.admin_url, notice: t('spree.locale_changed') }
+ end
else
- render json: { locale: I18n.locale }, status: 404
+ respond_to do |format|
+ format.json { render json: { locale: I18n.locale }, status: 404 }
+ format.html { redirect_back_or_to spree.admin_url, error: t('spree.error') }
+ end
end
end
private