Remove deprecated ugettext

This commit is contained in:
Raphael Michel 2020-03-09 14:12:09 +01:00
parent 2c803e3bbe
commit d1eea4e240
3 changed files with 10 additions and 10 deletions

View file

@ -1,5 +1,5 @@
from django.apps import AppConfig from django.apps import AppConfig
from django.utils.translation import ugettext_lazy from django.utils.translation import gettext_lazy
class PluginApp(AppConfig): class PluginApp(AppConfig):
@ -7,10 +7,10 @@ class PluginApp(AppConfig):
verbose_name = 'Service Fees' verbose_name = 'Service Fees'
class PretixPluginMeta: class PretixPluginMeta:
name = ugettext_lazy('Service Fees') name = gettext_lazy('Service Fees')
author = 'Raphael Michel' author = 'Raphael Michel'
category = 'FEATURE' category = 'FEATURE'
description = ugettext_lazy('This plugin allows to charge a service fee on all non-free orders.') description = gettext_lazy('This plugin allows to charge a service fee on all non-free orders.')
visible = True visible = True
version = '1.3.2' version = '1.3.2'

View file

@ -3,7 +3,7 @@ from decimal import Decimal
from django.urls import resolve, reverse from django.urls import resolve, reverse
from django.dispatch import receiver from django.dispatch import receiver
from django.http import HttpRequest from django.http import HttpRequest
from django.utils.translation import ugettext_lazy as _, ugettext, get_language from django.utils.translation import gettext_lazy as _, gettext, get_language
from pretix.base.decimal import round_decimal from pretix.base.decimal import round_decimal
from pretix.base.models import Event, Order, TaxRule from pretix.base.models import Event, Order, TaxRule
from pretix.base.models.orders import OrderFee from pretix.base.models.orders import OrderFee
@ -103,19 +103,19 @@ def front_page_top_recv(sender: Event, **kwargs):
fees = [] fees = []
fee_per_ticket = sender.settings.get('service_fee_per_ticket', as_type=Decimal) fee_per_ticket = sender.settings.get('service_fee_per_ticket', as_type=Decimal)
if fee_per_ticket: if fee_per_ticket:
fees = fees + ["{} {}".format(money_filter(fee_per_ticket, sender.currency), ugettext('per ticket'))] fees = fees + ["{} {}".format(money_filter(fee_per_ticket, sender.currency), gettext('per ticket'))]
fee_abs = sender.settings.get('service_fee_abs', as_type=Decimal) fee_abs = sender.settings.get('service_fee_abs', as_type=Decimal)
if fee_abs: if fee_abs:
fees = fees + ["{} {}".format(money_filter(fee_abs, sender.currency), ugettext('per order'))] fees = fees + ["{} {}".format(money_filter(fee_abs, sender.currency), gettext('per order'))]
fee_percent = sender.settings.get('service_fee_percent', as_type=Decimal) fee_percent = sender.settings.get('service_fee_percent', as_type=Decimal)
if fee_percent: if fee_percent:
fees = fees + ['{} % {}'.format(fee_percent, ugettext('per order'))] fees = fees + ['{} % {}'.format(fee_percent, gettext('per order'))]
if fee_per_ticket or fee_abs or fee_percent: if fee_per_ticket or fee_abs or fee_percent:
return '<p>%s</p>' % ugettext('A service fee of {} will be added on top of each order.').format( return '<p>%s</p>' % gettext('A service fee of {} will be added on top of each order.').format(
' {} '.format(ugettext('plus')).join(fees) ' {} '.format(gettext('plus')).join(fees)
) )

View file

@ -1,6 +1,6 @@
from django import forms from django import forms
from django.urls import reverse from django.urls import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from pretix.base.forms import SettingsForm from pretix.base.forms import SettingsForm
from pretix.base.models import Event from pretix.base.models import Event