Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

change functino getting locale to first look at locale saved in user if there is one

wjwitek609ca1efb944
diff --git a/core/lib/spree/core/controller_helpers/locale.rb b/core/lib/spree/core/controller_helpers/locale.rb
index 0a5b20a7d2..63251e6edd 100644
--- a/core/lib/spree/core/controller_helpers/locale.rb
+++ b/core/lib/spree/core/controller_helpers/locale.rb
@@ -22,7 +22,9 @@ module Spree
end
def current_locale
- @current_locale ||= if params[:locale].present? && supported_locale?(params[:locale])
+ @current_locale ||= if spree_current_user && supported_locale?(spree_current_user.saved_locale)
+ spree_current_user.saved_locale
+ elsif params[:locale].present? && supported_locale?(params[:locale])
params[:locale]
elsif respond_to?(:config_locale, true) && config_locale.present?
config_locale