Sha256: db985a11ec0ea6ac23d7f73da4f07cb168b17301ade799b177721aa3461b62d3

Contents?: true

Size: 459 Bytes

Versions: 20

Compression:

Stored size: 459 Bytes

Contents

# frozen_string_literal: true

module ShopifyApp
  module Localization
    extend ActiveSupport::Concern

    included do
      before_action :set_locale
    end

    private

    def set_locale
      if params[:locale]
        session[:locale] = params[:locale]
      else
        session[:locale] ||= I18n.default_locale
      end
      I18n.locale = session[:locale]
    rescue I18n::InvalidLocale
      I18n.locale = I18n.default_locale
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
shopify_app-21.6.0 lib/shopify_app/controller_concerns/localization.rb
shopify_app-21.5.0 lib/shopify_app/controller_concerns/localization.rb
shopify_app-21.4.1 lib/shopify_app/controller_concerns/localization.rb
shopify_app-21.4.0 lib/shopify_app/controller_concerns/localization.rb
shopify_app-21.3.1 lib/shopify_app/controller_concerns/localization.rb
shopify_app-21.3.0 lib/shopify_app/controller_concerns/localization.rb
shopify_app-21.2.0 lib/shopify_app/controller_concerns/localization.rb
shopify_app-21.1.1 lib/shopify_app/controller_concerns/localization.rb
shopify_app-21.1.0 lib/shopify_app/controller_concerns/localization.rb
shopify_app-21.0.0 lib/shopify_app/controller_concerns/localization.rb
shopify_app-20.2.0 lib/shopify_app/controller_concerns/localization.rb
shopify_app-20.1.1 lib/shopify_app/controller_concerns/localization.rb
shopify_app-20.1.0 lib/shopify_app/controller_concerns/localization.rb
shopify_app-20.0.2 lib/shopify_app/controller_concerns/localization.rb
shopify_app-20.0.1 lib/shopify_app/controller_concerns/localization.rb
shopify_app-20.0.0 lib/shopify_app/controller_concerns/localization.rb
shopify_app-19.1.0 lib/shopify_app/controller_concerns/localization.rb
shopify_app-19.0.2 lib/shopify_app/controller_concerns/localization.rb
shopify_app-19.0.1 lib/shopify_app/controller_concerns/localization.rb
shopify_app-19.0.0 lib/shopify_app/controller_concerns/localization.rb