Module: Locomotive::ActionController::LocaleHelpers
- Extended by:
- ActiveSupport::Concern
- Included in:
- Locomotive::Api::BaseController, BaseController, Public::BaseController, Public::PagesController
- Defined in:
- lib/locomotive/action_controller/locale_helpers.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #back_to_default_site_locale ⇒ Object
- #current_content_locale ⇒ Object
- #localized? ⇒ Boolean
- #set_back_office_locale ⇒ Object
- #set_current_content_locale ⇒ Object
- #setup_i18n_fallbacks ⇒ Object
Instance Method Details
#back_to_default_site_locale ⇒ Object
35 36 37 |
# File 'lib/locomotive/action_controller/locale_helpers.rb', line 35 def back_to_default_site_locale session[:content_locale] = ::Mongoid::Fields::I18n.locale = current_site.default_locale end |
#current_content_locale ⇒ Object
11 12 13 |
# File 'lib/locomotive/action_controller/locale_helpers.rb', line 11 def current_content_locale ::Mongoid::Fields::I18n.locale end |
#localized? ⇒ Boolean
45 46 47 |
# File 'lib/locomotive/action_controller/locale_helpers.rb', line 45 def localized? !!@locomotive_localized end |
#set_back_office_locale ⇒ Object
31 32 33 |
# File 'lib/locomotive/action_controller/locale_helpers.rb', line 31 def set_back_office_locale ::I18n.locale = current_locomotive_account.locale rescue Locomotive.config.default_locale end |
#set_current_content_locale ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/locomotive/action_controller/locale_helpers.rb', line 15 def set_current_content_locale if params[:content_locale].present? session[:content_locale] = params[:content_locale] end unless current_site.locales.include?(session[:content_locale]) session[:content_locale] = current_site.default_locale end ::Mongoid::Fields::I18n.locale = session[:content_locale] self.setup_i18n_fallbacks # logger.debug "*** content locale = #{session[:content_locale]} / #{::Mongoid::Fields::I18n.locale}" end |