Module: Concerns::Locale

Extended by:
ActiveSupport::Concern
Included in:
ApplicationController
Defined in:
app/controllers/concerns/locale.rb

Instance Method Summary collapse

Instance Method Details

#browser_languageObject



20
21
22
# File 'app/controllers/concerns/locale.rb', line 20

def browser_language
  request.env['HTTP_ACCEPT_LANGUAGE']&.scan(/^[a-z]{2}/)&.first
end

#default_languageObject



24
25
26
# File 'app/controllers/concerns/locale.rb', line 24

def default_language
  FoodsoftConfig[:default_locale] || ::I18n.default_locale
end

#explicitly_requested_languageObject



8
9
10
# File 'app/controllers/concerns/locale.rb', line 8

def explicitly_requested_language
  params[:locale]
end

#session_languageObject



16
17
18
# File 'app/controllers/concerns/locale.rb', line 16

def session_language
  session[:locale]
end

#user_settings_languageObject



12
13
14
# File 'app/controllers/concerns/locale.rb', line 12

def 
  current_user&.locale
end