Module: MnoEnterprise::Concerns::Controllers::I18n

Extended by:
ActiveSupport::Concern
Included in:
ApplicationController
Defined in:
lib/mno_enterprise/concerns/controllers/i18n.rb

Overview

Add a before_filter to set the locale based on the params or the default locale

Instance Method Summary collapse

Instance Method Details

#set_localeObject



9
10
11
12
13
14
15
# File 'lib/mno_enterprise/concerns/controllers/i18n.rb', line 9

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