Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove gettext occurrences from checkout

IKarbowiakc1347dd57ec6
diff --git a/saleor/checkout/__init__.py b/saleor/checkout/__init__.py
index 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.py
index 9b74d9a13c..5ef3f247da 100644
--- a/saleor/checkout/models.py
+++ b/saleor/checkout/models.py
@@ -8,7 +8,6 @@ from django.contrib.postgres.fields import JSONField
from django.core.validators import MinValueValidator
from django.db import models
from django.utils.encoding import smart_str
-from django.utils.translation import pgettext_lazy
from django_countries.fields import Country, CountryField
from django_prices.models import MoneyField
from 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.py
index c6abd66690..db8a2f031b 100644
--- a/saleor/checkout/utils.py
+++ b/saleor/checkout/utils.py
@@ -8,7 +8,7 @@ from django.db import transaction
from django.db.models import Max, Min, Sum
from django.utils import timezone
from django.utils.encoding import smart_text
-from django.utils.translation import get_language, pgettext
+from django.utils.translation import get_language
from prices import Money, MoneyRange, TaxedMoney, TaxedMoneyRange
from ..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_method
if 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 countries
shipping_country = checkout.shipping_address.country
if 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)