Module: Controllers::ContentLocalizable
- Extended by:
- ActiveSupport::Concern
- Included in:
- CatalogItemsController, ItemsController, ProductLinesController, ProductSpecificationsController
- Defined in:
- app/concerns/controllers/content_localizable.rb
Overview
This concern assists with content/mobility localization vs interface
localization, since this concern is purely CRM, I chosed to separate it
in its own concern for now - CB
This code is largely copied from lokalize example: https://www.youtube.com/watch?v=2Fyg-22iA9I
Instance Method Summary collapse
- #allow_content_locale_switch ⇒ Object
- #default_url_options ⇒ Object
-
#set_content_locale ⇒ Object
This is for UI editing and mobility.
Instance Method Details
#allow_content_locale_switch ⇒ Object
27 28 29 30 |
# File 'app/concerns/controllers/content_localizable.rb', line 27 def allow_content_locale_switch # This variable will determine if we need to show a locale selector in the menu interface of crm @content_localizable = true end |
#default_url_options ⇒ Object
32 33 34 |
# File 'app/concerns/controllers/content_localizable.rb', line 32 def super.merge(content_locale: Mobility.locale) end |
#set_content_locale ⇒ Object
This is for UI editing and mobility
22 23 24 25 |
# File 'app/concerns/controllers/content_localizable.rb', line 22 def set_content_locale @content_locale = extract_locale(:content_locale) || I18n.default_locale Mobility.locale = @content_locale end |