Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove gettext occurrences from core
IKarbowiaked126680ac38
diff --git a/saleor/core/db/fields.py b/saleor/core/db/fields.pyindex 07b3d1f358..15e2461bb8 100644--- a/saleor/core/db/fields.py+++ b/saleor/core/db/fields.py@@ -2,14 +2,11 @@ import jsonfrom typing import Callablefrom django.contrib.postgres.fields.jsonb import JSONField-from django.utils.translation import gettext_lazyclass SanitizedJSONField(JSONField):- description = gettext_lazy(- "A JSON field that runs a given sanitization method "- "before saving into the database."- )+ description = "A JSON field that runs a given sanitization method "+ "before saving into the database."def __init__(self, *args, sanitizer: Callable[[dict], dict], **kwargs):super(SanitizedJSONField, self).__init__(*args, **kwargs)diff --git a/saleor/core/exceptions.py b/saleor/core/exceptions.pyindex 0a403e4576..987f485d9f 100644--- a/saleor/core/exceptions.py+++ b/saleor/core/exceptions.py@@ -1,5 +1,3 @@-from django.utils.translation import ugettext_lazy as _-from ..checkout.error_codes import CheckoutErrorCode@@ -13,5 +11,5 @@ class InsufficientStock(Exception):class ReadOnlyException(Exception):def __init__(self, msg=None):if msg is None:- msg = _("API runs in read-only mode")+ msg = "API runs in read-only mode"super().__init__(msg)diff --git a/saleor/core/filters.py b/saleor/core/filters.pyindex 8a93931e67..d154d35997 100644--- a/saleor/core/filters.py+++ b/saleor/core/filters.py@@ -1,4 +1,4 @@-from django.utils.translation import npgettext+from django.template.defaultfilters import pluralizefrom django_filters import FilterSet@@ -22,9 +22,4 @@ class SortedFilterSet(FilterSet):Inherited by subclasses for record specific naming."""counter = self.qs.count()- return npgettext(- "Number of matching records in the dashboard list",- "Found %(counter)d matching record",- "Found %(counter)d matching records",- number=counter,- ) % {"counter": counter}+ return f"Found {counter} matching record{pluralize(counter)}"diff --git a/saleor/core/middleware.py b/saleor/core/middleware.pyindex 0113fab193..89ace81bdd 100644--- a/saleor/core/middleware.py+++ b/saleor/core/middleware.py@@ -9,7 +9,7 @@ from django.http import JsonResponsefrom django.template.response import TemplateResponsefrom django.utils import timezonefrom django.utils.functional import SimpleLazyObject-from django.utils.translation import get_language, ugettext_lazy as _+from django.utils.translation import get_languagefrom django_countries.fields import Countryfrom ..discount.utils import fetch_discounts@@ -154,9 +154,7 @@ class ReadOnlyMiddleware:if not self._is_graphql_request_blocked(request):return Noneerror = GraphQLView.format_error(- ReadOnlyException(- _("Be aware admin pirate! API runs in read-only mode!")- )+ ReadOnlyException("Be aware admin pirate! API runs in read-only mode!"))data = {"errors": [error], "data": None}response = JsonResponse(data=data, safe=False)diff --git a/saleor/core/weight.py b/saleor/core/weight.pyindex eeb29d361d..01773a7ccb 100644--- a/saleor/core/weight.py+++ b/saleor/core/weight.py@@ -13,7 +13,6 @@ In the end, it does not really matter unless you travel betweendifferent planets."""from django.contrib.sites.models import Site-from django.utils.translation import pgettext_lazyfrom measurement.measures import Weight@@ -24,10 +23,10 @@ class WeightUnits:GRAM = "g"CHOICES = [- (KILOGRAM, pgettext_lazy("Kilogram weight unit symbol", "kg")),- (POUND, pgettext_lazy("Pound weight unit symbol", "lb")),- (OUNCE, pgettext_lazy("Ounce weight unit symbol", "oz")),- (GRAM, pgettext_lazy("Gram weight unit symbol", "g")),+ (KILOGRAM, "kg"),+ (POUND, "lb"),+ (OUNCE, "oz"),+ (GRAM, "g"),]diff --git a/saleor/graphql/core/filters.py b/saleor/graphql/core/filters.pyindex dd0c937a82..66751cdfcd 100644--- a/saleor/graphql/core/filters.py+++ b/saleor/graphql/core/filters.py@@ -1,11 +1,10 @@import django_filtersfrom django.core.exceptions import ValidationError-from django.utils.translation import ugettext_lazy as _from django_filters.fields import MultipleChoiceFieldclass DefaultMultipleChoiceField(MultipleChoiceField):- default_error_messages = {"invalid_list": _("Enter a list of values.")}+ default_error_messages = {"invalid_list": "Enter a list of values."}def to_python(self, value):if not value: