Module: Concerns::Locale
- Extended by:
- ActiveSupport::Concern
- Included in:
- ApplicationController
- Defined in:
- app/controllers/concerns/locale.rb
Instance Method Summary collapse
- #browser_language ⇒ Object
- #default_language ⇒ Object
- #explicitly_requested_language ⇒ Object
- #session_language ⇒ Object
- #user_settings_language ⇒ Object
Instance Method Details
#browser_language ⇒ Object
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_language ⇒ Object
24 25 26 |
# File 'app/controllers/concerns/locale.rb', line 24 def default_language FoodsoftConfig[:default_locale] || ::I18n.default_locale end |
#explicitly_requested_language ⇒ Object
8 9 10 |
# File 'app/controllers/concerns/locale.rb', line 8 def explicitly_requested_language params[:locale] end |
#session_language ⇒ Object
16 17 18 |
# File 'app/controllers/concerns/locale.rb', line 16 def session_language session[:locale] end |
#user_settings_language ⇒ Object
12 13 14 |
# File 'app/controllers/concerns/locale.rb', line 12 def user_settings_language current_user&.locale end |