Sha256: a514db282e7d06725061bdb1c9f983a8dda300a41d320823885a4aef57c69101

Contents?: true

Size: 658 Bytes

Versions: 49

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

module Spree
  module Admin
    class LocaleController < Spree::Admin::BaseController
      def set
        locale = params[:switch_to_locale].to_s.presence

        if locale && I18n.available_locales.include?(locale.to_sym)
          I18n.locale = locale
          session[set_user_language_locale_key] = locale

          respond_to do |format|
            format.json { render json: { locale: locale, location: spree.admin_url } }
          end
        else
          respond_to do |format|
            format.json { render json: { locale: I18n.locale }, status: 404 }
          end
        end
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
solidus_backend-3.0.8 app/controllers/spree/admin/locale_controller.rb
solidus_backend-3.0.7 app/controllers/spree/admin/locale_controller.rb
solidus_backend-2.11.17 app/controllers/spree/admin/locale_controller.rb
solidus_backend-2.11.16 app/controllers/spree/admin/locale_controller.rb
solidus_backend-3.0.6 app/controllers/spree/admin/locale_controller.rb
solidus_backend-2.11.15 app/controllers/spree/admin/locale_controller.rb
solidus_backend-2.11.14 app/controllers/spree/admin/locale_controller.rb
solidus_backend-3.0.5 app/controllers/spree/admin/locale_controller.rb
solidus_backend-2.11.13 app/controllers/spree/admin/locale_controller.rb
solidus_backend-3.0.4 app/controllers/spree/admin/locale_controller.rb
solidus_backend-2.11.12 app/controllers/spree/admin/locale_controller.rb
solidus_backend-3.0.3 app/controllers/spree/admin/locale_controller.rb
solidus_backend-2.11.11 app/controllers/spree/admin/locale_controller.rb
solidus_backend-3.0.2 app/controllers/spree/admin/locale_controller.rb
solidus_backend-2.10.5 app/controllers/spree/admin/locale_controller.rb
solidus_backend-2.11.10 app/controllers/spree/admin/locale_controller.rb
solidus_backend-3.0.1 app/controllers/spree/admin/locale_controller.rb
solidus_backend-3.0.0 app/controllers/spree/admin/locale_controller.rb
solidus_backend-2.11.9 app/controllers/spree/admin/locale_controller.rb
solidus_backend-2.11.8 app/controllers/spree/admin/locale_controller.rb