Sha256: 6a3ce6d9d10da3b5652320b00643fd1ef63143f4b530fa2fa67522d0d7a4483d

Contents?: true

Size: 405 Bytes

Versions: 20

Compression:

Stored size: 405 Bytes

Contents

# Add a before_filter to set the locale based on the params or the default locale
module MnoEnterprise::Concerns::Controllers::I18n
  extend ActiveSupport::Concern

  included do
    before_action :set_locale
  end

  def set_locale
    I18n.locale =  if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym)
      params[:locale]
    else
      I18n.default_locale
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
mno-enterprise-core-3.4.0 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.3.3 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.3.2 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.2.1 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.3.1 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.3.0 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.2.0 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.1.4 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.0.7 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.1.3 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.0.6 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.1.2 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.0.5 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.1.1 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.0.4 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.1.0 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.0.3 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.0.2 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.0.1 lib/mno_enterprise/concerns/controllers/i18n.rb
mno-enterprise-core-3.0.0 lib/mno_enterprise/concerns/controllers/i18n.rb