Replaced ugettext and ugettext_lazy with gettext and gettext_lazy

ugettext and ugettext_lazy were deprecated in Django 3 and will be
removed in Django 4.
This commit is contained in:
2025-04-10 11:33:06 +02:00
parent 14c2a50503
commit d7e2acff34
26 changed files with 86 additions and 86 deletions

View File

@@ -6,7 +6,7 @@ import re
from babel.dates import format_date
from django import forms
from django.apps import apps
from django.utils.translation import get_language, ugettext, ugettext_lazy as _
from django.utils.translation import get_language, gettext, gettext_lazy as _
from django_countries.fields import Country, LazyTypedChoiceField
from datetimewidget.widgets import DateWidget, TimeWidget, DateTimeWidget
from six import string_types
@@ -840,7 +840,7 @@ class ChargesForm(EventCreateForm):
additional_costs_text = u''
if transport != 'coach':
additional_costs_text += ugettext(u'Fahrtkosten')
additional_costs_text += gettext(u'Fahrtkosten')
if transport == 'public':
pubtrans_planned = True
else:
@@ -852,7 +852,7 @@ class ChargesForm(EventCreateForm):
if accommodation != 'NONE':
if additional_costs_text:
additional_costs_text += u', '
additional_costs_text += ugettext(u'Unterkunft und Verpflegung')
additional_costs_text += gettext(u'Unterkunft und Verpflegung')
else:
ndays = 1
@@ -901,10 +901,10 @@ class ChargesForm(EventCreateForm):
self.fields['trainer1_reward'].initial = trainer1_reward
self.fields['trainer23_reward'].initial = trainer23_reward
self.fields['pubtrans_bonus'].widget.attrs['title'] = ugettext(u'Der Bonus wird nachträglich'
u' auf Meldung der Tourenleitung'
u' verrechnet und ist noch nicht'
u' in den hier dargestellten Zahlen enthalten.')
self.fields['pubtrans_bonus'].widget.attrs['title'] = gettext(u'Der Bonus wird nachträglich'
u' auf Meldung der Tourenleitung'
u' verrechnet und ist noch nicht'
u' in den hier dargestellten Zahlen enthalten.')
self.fields['charge'].widget.attrs['title'] = (u'%d € Beitrag \n'
u'+ %d Tage * %d € täglicher Beitrag \n'
u'+ %d halben Anreisetag * %d € halbtäglicher Beitrag'
@@ -941,7 +941,7 @@ class ChargesForm(EventCreateForm):
)
)
self.fields['additional_costs'].widget.attrs['placeholder'] = ugettext(u'Kann freigelassen werden')
self.fields['additional_costs'].widget.attrs['placeholder'] = gettext(u'Kann freigelassen werden')
self.fields['additional_costs'].initial = additional_costs_text
@@ -1011,32 +1011,32 @@ class DescriptionForm(EventCreateForm):
if mode == 'training':
# Titelprefix für Kurse
if level == 'family':
value += u'%s' % ugettext(u'Familienkurs')
value += u'%s' % gettext(u'Familienkurs')
elif level == 'beginner':
value += u'%s' % ugettext(u'Grundkurs')
value += u'%s' % gettext(u'Grundkurs')
else:
value += u'%s' % ugettext(u'Aufbaukurs')
value += u'%s' % gettext(u'Aufbaukurs')
if sport == 'B':
value += u' %s' % ugettext(u'Alpin')
value += u' %s' % gettext(u'Alpin')
elif sport == 'K':
if terrain == 'gym':
value += u' %s' % ugettext(u'Indoorklettern')
value += u' %s' % gettext(u'Indoorklettern')
elif terrain == 'crag':
value += u' %s' % ugettext(u'Fels')
value += u' %s' % gettext(u'Fels')
elif terrain == 'alpine':
value += u' %s' % ugettext(u'Alpinklettern')
value += u' %s' % gettext(u'Alpinklettern')
value += u': ...'
elif sport == 'W':
# Titelprefix für Wanderungen
if level == 'family':
value += u'%s ...' % ugettext(u'Familienwanderung')
value += u'%s ...' % gettext(u'Familienwanderung')
elif not last_day:
value += u'%s ...' % ugettext(u'Tageswanderung')
value += u'%s ...' % gettext(u'Tageswanderung')
elif level == 'family':
# Titelprefix für sonstige Familientouren
value += u'%s: ...' % ugettext(u'Familientour')
value += u'%s: ...' % gettext(u'Familientour')
if app_config.settings.forms_development_init:
if not value: