django4: replaced ugettext* calls with corresponding gettext* calls (#68593)
This commit is contained in:
parent
8e937c7471
commit
da4456096b
|
@ -23,7 +23,7 @@ from django.core.management.base import BaseCommand
|
|||
from django.db.transaction import atomic
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils import timezone, translation
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from chrono.agendas.models import Agenda
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ from django.db.transaction import atomic
|
|||
from django.template import Context, Template, TemplateSyntaxError, VariableDoesNotExist
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from requests import RequestException
|
||||
|
||||
from chrono.utils.requests_wrapper import requests
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
from django.utils import translation
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
|
||||
def translate_holidays_exceptions(apps, schema_editor):
|
||||
|
|
|
@ -51,9 +51,9 @@ from django.utils.module_loading import import_string
|
|||
from django.utils.safestring import mark_safe
|
||||
from django.utils.text import slugify
|
||||
from django.utils.timezone import is_aware, localtime, make_aware, make_naive, now, utc
|
||||
from django.utils.translation import pgettext_lazy, ugettext
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext
|
||||
from django.utils.translation import gettext
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.utils.translation import ngettext, pgettext_lazy
|
||||
|
||||
from chrono.interval import Interval, IntervalSet
|
||||
from chrono.utils.date import get_weekday_index
|
||||
|
@ -2386,7 +2386,7 @@ class TimePeriodExceptionSource(models.Model):
|
|||
if self.ics_filename is not None:
|
||||
return self.ics_filename
|
||||
if self.settings_label is not None:
|
||||
return ugettext(self.settings_label)
|
||||
return gettext(self.settings_label)
|
||||
return self.ics_url
|
||||
|
||||
def duplicate(self, desk_target=None):
|
||||
|
@ -3052,7 +3052,7 @@ class AgendaReminderSettings(models.Model):
|
|||
|
||||
def display_info(self):
|
||||
def get_message(days, by_email_or_sms):
|
||||
return ungettext(
|
||||
return ngettext(
|
||||
'Users will be reminded of their booking %(by_email_or_sms)s, one day in advance.',
|
||||
'Users will be reminded of their booking %(by_email_or_sms)s, %(days)s days in advance.',
|
||||
days,
|
||||
|
|
|
@ -4,7 +4,7 @@ import datetime
|
|||
from django.contrib.auth.models import Group
|
||||
from django.db import models, transaction
|
||||
from django.db.models import ExpressionWrapper, F
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from rest_framework import serializers
|
||||
from rest_framework.exceptions import ValidationError
|
||||
|
||||
|
|
|
@ -34,9 +34,9 @@ from django.utils.encoding import force_text
|
|||
from django.utils.formats import date_format
|
||||
from django.utils.timezone import localtime, make_aware, now
|
||||
from django.utils.translation import gettext
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.utils.translation import gettext_noop as N_
|
||||
from django.utils.translation import pgettext
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django_filters import rest_framework as filters
|
||||
from rest_framework import permissions
|
||||
from rest_framework.exceptions import ValidationError
|
||||
|
|
|
@ -36,7 +36,7 @@ from django.template import Context, Template, TemplateSyntaxError, VariableDoes
|
|||
from django.utils.encoding import force_text
|
||||
from django.utils.formats import date_format
|
||||
from django.utils.timezone import localtime, make_aware, now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from chrono.agendas.models import (
|
||||
WEEK_CHOICES,
|
||||
|
|
|
@ -43,8 +43,8 @@ from django.utils.encoding import force_text
|
|||
from django.utils.formats import date_format
|
||||
from django.utils.html import format_html
|
||||
from django.utils.timezone import localtime, make_aware, make_naive, now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.utils.translation import ngettext
|
||||
from django.views.generic import (
|
||||
CreateView,
|
||||
DayArchiveView,
|
||||
|
@ -811,13 +811,13 @@ class AgendasImportView(FormView):
|
|||
import_messages = {
|
||||
'agendas': {
|
||||
'create_noop': _('No agenda created.'),
|
||||
'create': lambda x: ungettext(
|
||||
'create': lambda x: ngettext(
|
||||
'An agenda has been created.',
|
||||
'%(count)d agendas have been created.',
|
||||
x,
|
||||
),
|
||||
'update_noop': _('No agenda updated.'),
|
||||
'update': lambda x: ungettext(
|
||||
'update': lambda x: ngettext(
|
||||
'An agenda has been updated.',
|
||||
'%(count)d agendas have been updated.',
|
||||
x,
|
||||
|
@ -825,13 +825,13 @@ class AgendasImportView(FormView):
|
|||
},
|
||||
'unavailability_calendars': {
|
||||
'create_noop': _('No unavailability calendar created.'),
|
||||
'create': lambda x: ungettext(
|
||||
'create': lambda x: ngettext(
|
||||
'An unavailability calendar has been created.',
|
||||
'%(count)d unavailability calendars have been created.',
|
||||
x,
|
||||
),
|
||||
'update_noop': _('No unavailability calendar updated.'),
|
||||
'update': lambda x: ungettext(
|
||||
'update': lambda x: ngettext(
|
||||
'An unavailability calendar has been updated.',
|
||||
'%(count)d unavailability calendars have been updated.',
|
||||
x,
|
||||
|
@ -839,13 +839,13 @@ class AgendasImportView(FormView):
|
|||
},
|
||||
'events_types': {
|
||||
'create_noop': _('No events type created.'),
|
||||
'create': lambda x: ungettext(
|
||||
'create': lambda x: ngettext(
|
||||
'An events type has been created.',
|
||||
'%(count)d events types have been created.',
|
||||
x,
|
||||
),
|
||||
'update_noop': _('No events type updated.'),
|
||||
'update': lambda x: ungettext(
|
||||
'update': lambda x: ngettext(
|
||||
'An events type has been updated.',
|
||||
'%(count)d events types have been updated.',
|
||||
x,
|
||||
|
@ -853,13 +853,13 @@ class AgendasImportView(FormView):
|
|||
},
|
||||
'resources': {
|
||||
'create_noop': _('No resource created.'),
|
||||
'create': lambda x: ungettext(
|
||||
'create': lambda x: ngettext(
|
||||
'A resource has been created.',
|
||||
'%(count)d resources have been created.',
|
||||
x,
|
||||
),
|
||||
'update_noop': _('No resource updated.'),
|
||||
'update': lambda x: ungettext(
|
||||
'update': lambda x: ngettext(
|
||||
'A resource has been updated.',
|
||||
'%(count)d resources have been updated.',
|
||||
x,
|
||||
|
@ -867,13 +867,13 @@ class AgendasImportView(FormView):
|
|||
},
|
||||
'categories': {
|
||||
'create_noop': _('No category created.'),
|
||||
'create': lambda x: ungettext(
|
||||
'create': lambda x: ngettext(
|
||||
'A category has been created.',
|
||||
'%(count)d categories have been created.',
|
||||
x,
|
||||
),
|
||||
'update_noop': _('No category updated.'),
|
||||
'update': lambda x: ungettext(
|
||||
'update': lambda x: ngettext(
|
||||
'A category has been updated.',
|
||||
'%(count)d categories have been updated.',
|
||||
x,
|
||||
|
@ -2869,7 +2869,7 @@ class AgendaAddTimePeriodExceptionView(ManagedDeskMixin, CreateView):
|
|||
def form_valid(self, form):
|
||||
result = super().form_valid(form)
|
||||
all_desks = form.cleaned_data.get('all_desks')
|
||||
message = ungettext(
|
||||
message = ngettext(
|
||||
'Exception added.',
|
||||
'Exceptions added.',
|
||||
len(form.exceptions) if all_desks else 1,
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
import copy
|
||||
|
||||
from django.core.exceptions import FieldDoesNotExist, ValidationError
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class ICSError(Exception):
|
||||
|
|
Loading…
Reference in New Issue