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 ⇒ Boolean
Flags the controller to render the content-locale selector in the CRM menu.
-
#default_url_options ⇒ Hash
Merges the current Mobility content locale into generated URLs.
-
#set_content_locale ⇒ Symbol
This is for UI editing and mobility.
Instance Method Details
#allow_content_locale_switch ⇒ Boolean
Flags the controller to render the content-locale selector in the CRM menu.
36 37 38 39 |
# File 'app/concerns/controllers/content_localizable.rb', line 36 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 ⇒ Hash
Merges the current Mobility content locale into generated URLs.
44 45 46 |
# File 'app/concerns/controllers/content_localizable.rb', line 44 def super.merge(content_locale: Mobility.locale) end |
#set_content_locale ⇒ Symbol
This is for UI editing and mobility
28 29 30 31 |
# File 'app/concerns/controllers/content_localizable.rb', line 28 def set_content_locale @content_locale = extract_locale(:content_locale) || I18n.default_locale Mobility.locale = @content_locale end |