Skip to content

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

Remove gettext occurrences from shipping and webhook

IKarbowiak35fe317e4f48
diff --git a/saleor/shipping/__init__.py b/saleor/shipping/__init__.py
index b4b0a9c5d2..92a86a08b6 100644
--- a/saleor/shipping/__init__.py
+++ b/saleor/shipping/__init__.py
@@ -1,11 +1,8 @@
-from django.utils.translation import pgettext_lazy
-
-
class ShippingMethodType:
PRICE_BASED = "price"
WEIGHT_BASED = "weight"
CHOICES = [
- (PRICE_BASED, pgettext_lazy("Type of shipping", "Price based shipping")),
- (WEIGHT_BASED, pgettext_lazy("Type of shipping", "Weight based shipping")),
+ (PRICE_BASED, "Price based shipping"),
+ (WEIGHT_BASED, "Weight based shipping"),
]
diff --git a/saleor/shipping/models.py b/saleor/shipping/models.py
index b5d4774ce0..0b8d5d3fa7 100644
--- a/saleor/shipping/models.py
+++ b/saleor/shipping/models.py
@@ -4,7 +4,6 @@ from django.conf import settings
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.db.models import Q
-from django.utils.translation import pgettext_lazy
from django_countries.fields import CountryField
from django_measurement.models import MeasurementField
from django_prices.models import MoneyField
@@ -55,14 +54,15 @@ def _get_weight_type_display(min_weight, max_weight):
max_weight = convert_weight(max_weight, default_unit)
if max_weight is None:
- return pgettext_lazy(
- "Applies to orders heavier than the threshold", "%(min_weight)s and up"
- ) % {"min_weight": min_weight}
- return pgettext_lazy(
- "Applies to orders of total weight within this range",
- "%(min_weight)s to %(max_weight)s"
- % {"min_weight": min_weight, "max_weight": max_weight},
- )
+ return (
+ "Applies to orders heavier than the threshold",
+ "%(min_weight)s and up" % {"min_weight": min_weight},
+ )
+ return ("Applies to orders of total weight within this range",)
+ "%(min_weight)s to %(max_weight)s" % {
+ "min_weight": min_weight,
+ "max_weight": max_weight,
+ },
class ShippingZone(models.Model):
@@ -85,10 +85,7 @@ class ShippingZone(models.Model):
class Meta:
permissions = (
- (
- ShippingPermissions.MANAGE_SHIPPING.codename,
- pgettext_lazy("Permission description", "Manage shipping."),
- ),
+ (ShippingPermissions.MANAGE_SHIPPING.codename, "Manage shipping."),
)
diff --git a/saleor/webhook/event_types.py b/saleor/webhook/event_types.py
index db20bfeea6..458eec91f1 100644
--- a/saleor/webhook/event_types.py
+++ b/saleor/webhook/event_types.py
@@ -1,5 +1,3 @@
-from django.utils.translation import pgettext_lazy
-
from ..core.permissions import (
AccountPermissions,
CheckoutPermissions,
@@ -35,46 +33,15 @@ class WebhookEventType:
}
CHOICES = [
- (ANY, pgettext_lazy("Any events", DISPLAY_LABELS[ANY])),
- (
- ORDER_CREATED,
- pgettext_lazy("Order has been placed", DISPLAY_LABELS[ORDER_CREATED]),
- ),
- (
- ORDER_FULLY_PAID,
- pgettext_lazy(
- "Order has been fully paid", DISPLAY_LABELS[ORDER_FULLY_PAID]
- ),
- ),
- (
- ORDER_UPDATED,
- pgettext_lazy("Order has been updated", DISPLAY_LABELS[ORDER_UPDATED]),
- ),
- (
- ORDER_CANCELLED,
- pgettext_lazy("Order has been cancelled", DISPLAY_LABELS[ORDER_CANCELLED]),
- ),
- (
- ORDER_FULFILLED,
- pgettext_lazy("Order has been fulfilled", DISPLAY_LABELS[ORDER_FULFILLED]),
- ),
- (
- CUSTOMER_CREATED,
- pgettext_lazy(
- "Customer has been created", DISPLAY_LABELS[CUSTOMER_CREATED]
- ),
- ),
- (
- PRODUCT_CREATED,
- pgettext_lazy("Product has been created", DISPLAY_LABELS[PRODUCT_CREATED]),
- ),
- (
- CHECKOUT_QUANTITY_CHANGED,
- pgettext_lazy(
- "Checkout's quantity has changed",
- DISPLAY_LABELS[CHECKOUT_QUANTITY_CHANGED],
- ),
- ),
+ (ANY, DISPLAY_LABELS[ANY]),
+ (ORDER_CREATED, DISPLAY_LABELS[ORDER_CREATED]),
+ (ORDER_FULLY_PAID, DISPLAY_LABELS[ORDER_FULLY_PAID]),
+ (ORDER_UPDATED, DISPLAY_LABELS[ORDER_UPDATED]),
+ (ORDER_CANCELLED, DISPLAY_LABELS[ORDER_CANCELLED]),
+ (ORDER_FULFILLED, DISPLAY_LABELS[ORDER_FULFILLED]),
+ (CUSTOMER_CREATED, DISPLAY_LABELS[CUSTOMER_CREATED]),
+ (PRODUCT_CREATED, DISPLAY_LABELS[PRODUCT_CREATED]),
+ (CHECKOUT_QUANTITY_CHANGED, DISPLAY_LABELS[CHECKOUT_QUANTITY_CHANGED]),
]
PERMISSIONS = {
diff --git a/saleor/webhook/models.py b/saleor/webhook/models.py
index 458ba19fee..e9fa4b8e05 100644
--- a/saleor/webhook/models.py
+++ b/saleor/webhook/models.py
@@ -1,5 +1,4 @@
from django.db import models
-from django.utils.translation import pgettext_lazy
from ..account.models import ServiceAccount
from ..core.permissions import WebhookPermissions
@@ -16,10 +15,7 @@ class Webhook(models.Model):
class Meta:
permissions = (
- (
- WebhookPermissions.MANAGE_WEBHOOKS.codename,
- pgettext_lazy("Webhook description", "Manage webhooks"),
- ),
+ (WebhookPermissions.MANAGE_WEBHOOKS.codename, "Manage webhooks"),
)