Module: Spree::Admin::LocaleConcern
- Extended by:
- ActiveSupport::Concern
- Included in:
- BaseController, UserSessionsController
- Defined in:
- app/controllers/concerns/spree/admin/locale_concern.rb
Overview
Decouples the admin UI language from the store's content language.
I18n.locale drives the UI chrome (Spree.t labels) and follows the
staff member's chosen admin language. Mobility.locale and
Spree::Current.content_locale drive translated record fields
(product/store names) and are pinned to the store's content locale —
otherwise switching the admin to, say, Polish would make every
Mobility-backed field fall back to nil for stores that don't translate
their catalog into Polish.
Shared by Spree::Admin::BaseController and the Devise-based pre-auth
controllers (UserSessionsController), which can't inherit admin
behavior via the controller chain — hence a concern both include.
Devise-based includers opt into the login-screen locale handling with
before_action :set_login_locale.
Constant Summary collapse
- ADMIN_LOCALE_COOKIE =
Cookie storing the admin UI language chosen on the login screen, so a guest's pre-auth selection carries into the authenticated session. A signed-in user's saved
selected_localestill takes precedence. :spree_admin_locale