Skip to content

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

Remove gettext occurrence from extensions

IKarbowiak97716ff7946f
diff --git a/saleor/extensions/__init__.py b/saleor/extensions/__init__.py
index c29788c213..8852a93d0f 100644
--- a/saleor/extensions/__init__.py
+++ b/saleor/extensions/__init__.py
@@ -1,8 +1,6 @@
import importlib
from typing import List
-from django.utils.translation import pgettext_lazy
-
from .checks import check_extensions # NOQA: F401
@@ -27,14 +25,8 @@ class ConfigurationTypeField:
SECRET = "Secret"
PASSWORD = "Password"
CHOICES = [
- (STRING, pgettext_lazy("Type of the configuration field", "Field is a String")),
- (
- BOOLEAN,
- pgettext_lazy("Type of the configuration field", "Field is a Boolean"),
- ),
- (SECRET, pgettext_lazy("Type of the configuration field", "Field is a Secret")),
- (
- PASSWORD,
- pgettext_lazy("Type of the configuration field", "Field is a Password"),
- ),
+ (STRING, "Field is a String"),
+ (BOOLEAN, "Field is a Boolean"),
+ (SECRET, "Field is a Secret"),
+ (PASSWORD, "Field is a Password"),
]
diff --git a/saleor/extensions/models.py b/saleor/extensions/models.py
index e8a2708b45..81f09aa6b5 100644
--- a/saleor/extensions/models.py
+++ b/saleor/extensions/models.py
@@ -1,6 +1,5 @@
from django.contrib.postgres.fields import JSONField
from django.db import models
-from django.utils.translation import pgettext_lazy
from saleor.core.permissions import ExtensionsPermissions
from saleor.core.utils.json_serializer import CustomJsonEncoder
@@ -16,10 +15,7 @@ class PluginConfiguration(models.Model):
class Meta:
permissions = (
- (
- ExtensionsPermissions.MANAGE_PLUGINS.codename,
- pgettext_lazy("Plugin description", "Manage plugins"),
- ),
+ (ExtensionsPermissions.MANAGE_PLUGINS.codename, "Manage plugins"),
)
def __str__(self):
diff --git a/saleor/extensions/plugins/avatax/__init__.py b/saleor/extensions/plugins/avatax/__init__.py
index 54ef4a74df..2013f86b7a 100644
--- a/saleor/extensions/plugins/avatax/__init__.py
+++ b/saleor/extensions/plugins/avatax/__init__.py
@@ -10,7 +10,6 @@ import requests
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.cache import cache
-from django.utils.translation import pgettext_lazy
from requests.auth import HTTPBasicAuth
from ....checkout import base_calculations
@@ -53,10 +52,7 @@ class TransactionType:
class CustomerErrors:
- DEFAULT_MSG = pgettext_lazy(
- "Default tax error msg",
- "We are not able to calculate taxes for your order. Please try later",
- )
+ DEFAULT_MSG = "We are not able to calculate taxes for your order. Please try later"
ERRORS = ("InvalidPostalCode", "InvalidAddress", "MissingAddress")
@classmethod
diff --git a/saleor/extensions/plugins/avatax/plugin.py b/saleor/extensions/plugins/avatax/plugin.py
index 64546314d1..0912054820 100644
--- a/saleor/extensions/plugins/avatax/plugin.py
+++ b/saleor/extensions/plugins/avatax/plugin.py
@@ -5,7 +5,6 @@ from urllib.parse import urljoin
from django.conf import settings
from django.core.exceptions import ValidationError
-from django.utils.translation import pgettext_lazy
from prices import Money, TaxedMoney, TaxedMoneyRange
from ....core.taxes import TaxError, TaxType, zero_taxed_money
@@ -46,45 +45,32 @@ class AvataxPlugin(BasePlugin):
CONFIG_STRUCTURE = {
"Username or account": {
"type": ConfigurationTypeField.STRING,
- "help_text": pgettext_lazy(
- "Plugin help text", "Provide user or account details"
- ),
- "label": pgettext_lazy("Plugin label", "Username or account"),
+ "help_text": "Provide user or account details",
+ "label": "Username or account",
},
"Password or license": {
"type": ConfigurationTypeField.PASSWORD,
- "help_text": pgettext_lazy(
- "Plugin help text", "Provide password or license details"
- ),
- "label": pgettext_lazy("Plugin label", "Password or license"),
+ "help_text": "Provide password or license details",
+ "label": "Password or license",
},
"Use sandbox": {
"type": ConfigurationTypeField.BOOLEAN,
- "help_text": pgettext_lazy(
- "Plugin help text",
- "Determines if Saleor should use Avatax sandbox API.",
- ),
- "label": pgettext_lazy("Plugin label", "Use sandbox"),
+ "help_text": "Determines if Saleor should use Avatax sandbox API.",
+ "label": "Use sandbox",
},
"Company name": {
"type": ConfigurationTypeField.STRING,
- "help_text": pgettext_lazy(
- "Plugin help text",
- "Avalara needs to receive company code. Some more "
- "complicated systems can use more than one company "
- "code, in that case, this variable should be changed "
- "based on data from Avalara's admin panel",
- ),
- "label": pgettext_lazy("Plugin label", "Company name"),
+ "help_text": "Avalara needs to receive company code. Some more "
+ "complicated systems can use more than one company "
+ "code, in that case, this variable should be changed "
+ "based on data from Avalara's admin panel",
+ "label": "Company name",
},
"Autocommit": {
"type": ConfigurationTypeField.BOOLEAN,
- "help_text": pgettext_lazy(
- "Plugin help text",
- "Determines, if all transactions sent to Avalara "
- "should be committed by default.",
- ),
- "label": pgettext_lazy("Plugin label", "Autocommit"),
+ "help_text": "Determines, if all transactions sent to Avalara "
+ "should be committed by default.",
+ "label": "Autocommit",
},
}
diff --git a/saleor/extensions/plugins/vatlayer/__init__.py b/saleor/extensions/plugins/vatlayer/__init__.py
index 8326aa06f3..49ba84b42b 100644
--- a/saleor/extensions/plugins/vatlayer/__init__.py
+++ b/saleor/extensions/plugins/vatlayer/__init__.py
@@ -1,4 +1,3 @@
-from django.utils.translation import pgettext_lazy
from django_prices_vatlayer.utils import get_tax_for_rate, get_tax_rates_for_country
from prices import Money, MoneyRange, TaxedMoney, TaxedMoneyRange
@@ -33,43 +32,31 @@ class TaxRateType:
WINE = "wine"
CHOICES = (
- (ACCOMMODATION, pgettext_lazy("VAT rate type", "accommodation")),
- (
- ADMISSION_TO_CULTURAL_EVENTS,
- pgettext_lazy("VAT rate type", "admission to cultural events"),
- ),
- (
- ADMISSION_TO_ENTERTAINMENT_EVENTS,
- pgettext_lazy("VAT rate type", "admission to entertainment events"),
- ),
- (
- ADMISSION_TO_SPORTING_EVENTS,
- pgettext_lazy("VAT rate type", "admission to sporting events"),
- ),
- (ADVERTISING, pgettext_lazy("VAT rate type", "advertising")),
- (
- AGRICULTURAL_SUPPLIES,
- pgettext_lazy("VAT rate type", "agricultural supplies"),
- ),
- (BABY_FOODSTUFFS, pgettext_lazy("VAT rate type", "baby foodstuffs")),
- (BIKES, pgettext_lazy("VAT rate type", "bikes")),
- (BOOKS, pgettext_lazy("VAT rate type", "books")),
- (CHILDRENDS_CLOTHING, pgettext_lazy("VAT rate type", "childrens clothing")),
- (DOMESTIC_FUEL, pgettext_lazy("VAT rate type", "domestic fuel")),
- (DOMESTIC_SERVICES, pgettext_lazy("VAT rate type", "domestic services")),
- (E_BOOKS, pgettext_lazy("VAT rate type", "e-books")),
- (FOODSTUFFS, pgettext_lazy("VAT rate type", "foodstuffs")),
- (HOTELS, pgettext_lazy("VAT rate type", "hotels")),
- (MEDICAL, pgettext_lazy("VAT rate type", "medical")),
- (NEWSPAPERS, pgettext_lazy("VAT rate type", "newspapers")),
- (PASSENGER_TRANSPORT, pgettext_lazy("VAT rate type", "passenger transport")),
- (PHARMACEUTICALS, pgettext_lazy("VAT rate type", "pharmaceuticals")),
- (PROPERTY_RENOVATIONS, pgettext_lazy("VAT rate type", "property renovations")),
- (RESTAURANTS, pgettext_lazy("VAT rate type", "restaurants")),
- (SOCIAL_HOUSING, pgettext_lazy("VAT rate type", "social housing")),
- (STANDARD, pgettext_lazy("VAT rate type", "standard")),
- (WATER, pgettext_lazy("VAT rate type", "water")),
- (WINE, pgettext_lazy("VAT rate type", "wine")),
+ (ACCOMMODATION, "accommodation"),
+ (ADMISSION_TO_CULTURAL_EVENTS, "admission to cultural events"),
+ (ADMISSION_TO_ENTERTAINMENT_EVENTS, "admission to entertainment events"),
+ (ADMISSION_TO_SPORTING_EVENTS, "admission to sporting events"),
+ (ADVERTISING, "advertising"),
+ (AGRICULTURAL_SUPPLIES, "agricultural supplies"),
+ (BABY_FOODSTUFFS, "baby foodstuffs"),
+ (BIKES, "bikes"),
+ (BOOKS, "books"),
+ (CHILDRENDS_CLOTHING, "childrens clothing"),
+ (DOMESTIC_FUEL, "domestic fuel"),
+ (DOMESTIC_SERVICES, "domestic services"),
+ (E_BOOKS, "e-books"),
+ (FOODSTUFFS, "foodstuffs"),
+ (HOTELS, "hotels"),
+ (MEDICAL, "medical"),
+ (NEWSPAPERS, "newspapers"),
+ (PASSENGER_TRANSPORT, "passenger transport"),
+ (PHARMACEUTICALS, "pharmaceuticals"),
+ (PROPERTY_RENOVATIONS, "property renovations"),
+ (RESTAURANTS, "restaurants"),
+ (SOCIAL_HOUSING, "social housing"),
+ (STANDARD, "standard"),
+ (WATER, "water"),
+ (WINE, "wine"),
)