Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove gettext occurrences from checkout
IKarbowiakc1347dd57ec6
diff --git a/saleor/checkout/__init__.py b/saleor/checkout/__init__.pyindex 1c17e8e6de..a2fd060bcd 100644--- a/saleor/checkout/__init__.py+++ b/saleor/checkout/__init__.py@@ -1,7 +1,5 @@import logging-from django.utils.translation import pgettext_lazy-logger = logging.getLogger(__name__)@@ -10,6 +8,6 @@ class AddressType:SHIPPING = "shipping"CHOICES = [- (BILLING, pgettext_lazy("Type of address used to fulfill order", "Billing")),- (SHIPPING, pgettext_lazy("Type of address used to fulfill order", "Shipping")),+ (BILLING, "Billing"),+ (SHIPPING, "Shipping"),]diff --git a/saleor/checkout/models.py b/saleor/checkout/models.pyindex 9b74d9a13c..5ef3f247da 100644--- a/saleor/checkout/models.py+++ b/saleor/checkout/models.py@@ -8,7 +8,6 @@ from django.contrib.postgres.fields import JSONFieldfrom django.core.validators import MinValueValidatorfrom django.db import modelsfrom django.utils.encoding import smart_str-from django.utils.translation import pgettext_lazyfrom django_countries.fields import Country, CountryFieldfrom django_prices.models import MoneyFieldfrom prices import Money@@ -102,10 +101,7 @@ class Checkout(ModelWithMetadata):class Meta:ordering = ("-last_change",)permissions = (- (- CheckoutPermissions.MANAGE_CHECKOUTS.codename,- pgettext_lazy("Permission description", "Manage checkouts"),- ),+ (CheckoutPermissions.MANAGE_CHECKOUTS.codename, "Manage checkouts"),)def __repr__(self):diff --git a/saleor/checkout/utils.py b/saleor/checkout/utils.pyindex c6abd66690..db8a2f031b 100644--- a/saleor/checkout/utils.py+++ b/saleor/checkout/utils.py@@ -8,7 +8,7 @@ from django.db import transactionfrom django.db.models import Max, Min, Sumfrom django.utils import timezonefrom django.utils.encoding import smart_text-from django.utils.translation import get_language, pgettext+from django.utils.translation import get_languagefrom prices import Money, MoneyRange, TaxedMoney, TaxedMoneyRangefrom ..account.models import User@@ -215,23 +215,17 @@ def _get_shipping_voucher_discount_for_checkout():"""Calculate discount value for a voucher of shipping type."""if not checkout.is_shipping_required():- msg = pgettext(- "Voucher not applicable", "Your order does not require shipping."- )+ msg = "Your order does not require shipping."raise NotApplicable(msg)shipping_method = checkout.shipping_methodif not shipping_method:- msg = pgettext(- "Voucher not applicable", "Please select a shipping method first."- )+ msg = "Please select a shipping method first."raise NotApplicable(msg)# check if voucher is limited to specified countriesshipping_country = checkout.shipping_address.countryif voucher.countries and shipping_country.code not in voucher.countries:- msg = pgettext(- "Voucher not applicable", "This offer is not valid in your country."- )+ msg = "This offer is not valid in your country."raise NotApplicable(msg)shipping_price = calculations.checkout_shipping_price(checkout, discounts).gross@@ -246,9 +240,7 @@ def _get_products_voucher_discount(if voucher.type == VoucherType.SPECIFIC_PRODUCT:prices = get_prices_of_discounted_specific_product(checkout, voucher, discounts)if not prices:- msg = pgettext(- "Voucher not applicable", "This offer is only valid for selected items."- )+ msg = "This offer is only valid for selected items."raise NotApplicable(msg)return get_products_voucher_discount(voucher, prices)@@ -529,10 +521,7 @@ def _get_voucher_data_for_order(checkout: Checkout) -> dict:voucher = get_voucher_for_checkout(checkout, with_lock=True)if checkout.voucher_code and not voucher:- msg = pgettext(- "Voucher not applicable",- "Voucher expired in meantime. Order placement aborted.",- )+ msg = "Voucher expired in meantime. Order placement aborted."raise NotApplicable(msg)if not voucher:@@ -601,10 +590,7 @@ def validate_gift_cards(checkout: Checkout):not checkout.gift_cards.count()== checkout.gift_cards.active(date=date.today()).count()):- msg = pgettext(- "Gift card not applicable",- "Gift card has expired. Order placement cancelled.",- )+ msg = "Gift card has expired. Order placement cancelled."raise NotApplicable(msg)