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.

move error messages to translations

KacperMekarskia996dd6ead65
diff --git a/core/app/models/concerns/spree/user_address.rb b/core/app/models/concerns/spree/user_address.rb
index fcdede22de..256a9581d9 100644
--- a/core/app/models/concerns/spree/user_address.rb
+++ b/core/app/models/concerns/spree/user_address.rb
@@ -35,17 +35,14 @@ module Spree
private
- BELONGS_TO_OTHER_USER = 'belongs to other user'
- ADDRESS_ASSOCIATED_WITH_COMPLETED_ORDER = 'associated with completed order'
-
def address_not_associated_with_other_user
- errors.add(:bill_address_id, BELONGS_TO_OTHER_USER) if bill_address&.user_id && self != bill_address&.user
- errors.add(:ship_address_id, BELONGS_TO_OTHER_USER) if ship_address&.user_id && self != ship_address&.user
+ errors.add(:bill_address_id, :belongs_to_other_user) if bill_address&.user_id && self != bill_address&.user
+ errors.add(:ship_address_id, :belongs_to_other_user) if ship_address&.user_id && self != ship_address&.user
end
def address_not_associated_with_placed_order
- errors.add(:bill_address_id, ADDRESS_ASSOCIATED_WITH_COMPLETED_ORDER) if orders.complete.where(bill_address: bill_address_id).any?
- errors.add(:ship_address_id, ADDRESS_ASSOCIATED_WITH_COMPLETED_ORDER) if orders.complete.where(ship_address: ship_address_id).any?
+ errors.add(:bill_address_id, :associated_with_completed_order) if orders.complete.where(bill_address: bill_address_id).any?
+ errors.add(:ship_address_id, :associated_with_completed_order) if orders.complete.where(ship_address: ship_address_id).any?
end
end
end
diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml
index a84da6c25c..9c7c09d26d 100644
--- a/core/config/locales/en.yml
+++ b/core/config/locales/en.yml
@@ -324,6 +324,14 @@ en:
base:
card_expired: "Card has expired"
expiry_invalid: "Card expiration is invalid"
+ spree/legacy_user:
+ attributes:
+ bill_address_id:
+ belongs_to_other_user: belongs to other user
+ associated_with_completed_order: associated with completed order
+ ship_address_id:
+ belongs_to_other_user: belongs to other user
+ associated_with_completed_order: associated with completed order
spree/line_item:
attributes:
currency: