mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Converted usage of ugettext* functions to their gettext* aliases
Thanks Tim Graham for the review.
This commit is contained in:
@@ -9,7 +9,7 @@ from django.utils.functional import cached_property
|
||||
from django.utils.html import conditional_escape, format_html, html_safe
|
||||
from django.utils.inspect import func_supports_parameter
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
__all__ = ('BoundField',)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ from django.utils.dateparse import parse_duration
|
||||
from django.utils.duration import duration_string
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.ipv6 import clean_ipv6_address
|
||||
from django.utils.translation import ugettext_lazy as _, ungettext_lazy
|
||||
from django.utils.translation import gettext_lazy as _, ngettext_lazy
|
||||
|
||||
__all__ = (
|
||||
'Field', 'CharField', 'IntegerField',
|
||||
@@ -534,7 +534,7 @@ class FileField(Field):
|
||||
'invalid': _("No file was submitted. Check the encoding type on the form."),
|
||||
'missing': _("No file was submitted."),
|
||||
'empty': _("The submitted file is empty."),
|
||||
'max_length': ungettext_lazy(
|
||||
'max_length': ngettext_lazy(
|
||||
'Ensure this filename has at most %(max)d character (it has %(length)d).',
|
||||
'Ensure this filename has at most %(max)d characters (it has %(length)d).',
|
||||
'max'),
|
||||
|
||||
@@ -16,7 +16,7 @@ from django.utils.encoding import force_text
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.html import conditional_escape, html_safe
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from .renderers import get_default_renderer
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.forms.widgets import HiddenInput
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.html import html_safe
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import ugettext as _, ungettext
|
||||
from django.utils.translation import gettext as _, ngettext
|
||||
|
||||
__all__ = ('BaseFormSet', 'formset_factory', 'all_valid')
|
||||
|
||||
@@ -341,14 +341,14 @@ class BaseFormSet:
|
||||
if (self.validate_max and
|
||||
self.total_form_count() - len(self.deleted_forms) > self.max_num) or \
|
||||
self.management_form.cleaned_data[TOTAL_FORM_COUNT] > self.absolute_max:
|
||||
raise ValidationError(ungettext(
|
||||
raise ValidationError(ngettext(
|
||||
"Please submit %d or fewer forms.",
|
||||
"Please submit %d or fewer forms.", self.max_num) % self.max_num,
|
||||
code='too_many_forms',
|
||||
)
|
||||
if (self.validate_min and
|
||||
self.total_form_count() - len(self.deleted_forms) - empty_forms_count < self.min_num):
|
||||
raise ValidationError(ungettext(
|
||||
raise ValidationError(ngettext(
|
||||
"Please submit %d or more forms.",
|
||||
"Please submit %d or more forms.", self.min_num) % self.min_num,
|
||||
code='too_few_forms')
|
||||
|
||||
@@ -18,7 +18,7 @@ from django.forms.widgets import (
|
||||
)
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.text import capfirst, get_text_list
|
||||
from django.utils.translation import ugettext, ugettext_lazy as _
|
||||
from django.utils.translation import gettext, gettext_lazy as _
|
||||
|
||||
__all__ = (
|
||||
'ModelForm', 'BaseModelForm', 'model_to_dict', 'fields_for_model',
|
||||
@@ -719,16 +719,16 @@ class BaseModelFormSet(BaseFormSet):
|
||||
|
||||
def get_unique_error_message(self, unique_check):
|
||||
if len(unique_check) == 1:
|
||||
return ugettext("Please correct the duplicate data for %(field)s.") % {
|
||||
return gettext("Please correct the duplicate data for %(field)s.") % {
|
||||
"field": unique_check[0],
|
||||
}
|
||||
else:
|
||||
return ugettext("Please correct the duplicate data for %(field)s, which must be unique.") % {
|
||||
return gettext("Please correct the duplicate data for %(field)s, which must be unique.") % {
|
||||
"field": get_text_list(unique_check, _("and")),
|
||||
}
|
||||
|
||||
def get_date_error_message(self, date_check):
|
||||
return ugettext(
|
||||
return gettext(
|
||||
"Please correct the duplicate data for %(field_name)s "
|
||||
"which must be unique for the %(lookup)s in %(date_field)s."
|
||||
) % {
|
||||
@@ -738,7 +738,7 @@ class BaseModelFormSet(BaseFormSet):
|
||||
}
|
||||
|
||||
def get_form_error(self):
|
||||
return ugettext("Please correct the duplicate values below.")
|
||||
return gettext("Please correct the duplicate values below.")
|
||||
|
||||
def save_existing_objects(self, commit=True):
|
||||
self.changed_objects = []
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.core.exceptions import ValidationError # backwards compatibility
|
||||
from django.utils import timezone
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.html import escape, format_html, format_html_join, html_safe
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
def pretty_name(name):
|
||||
|
||||
@@ -17,7 +17,7 @@ from django.utils.encoding import force_text
|
||||
from django.utils.formats import get_format
|
||||
from django.utils.html import format_html, html_safe
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import ugettext_lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from .renderers import get_default_renderer
|
||||
|
||||
@@ -358,9 +358,9 @@ FILE_INPUT_CONTRADICTION = object()
|
||||
|
||||
|
||||
class ClearableFileInput(FileInput):
|
||||
clear_checkbox_label = ugettext_lazy('Clear')
|
||||
initial_text = ugettext_lazy('Currently')
|
||||
input_text = ugettext_lazy('Change')
|
||||
clear_checkbox_label = _('Clear')
|
||||
initial_text = _('Currently')
|
||||
input_text = _('Change')
|
||||
template_name = 'django/forms/widgets/clearable_file_input.html'
|
||||
|
||||
def clear_checkbox_name(self, name):
|
||||
@@ -690,9 +690,9 @@ class NullBooleanSelect(Select):
|
||||
"""
|
||||
def __init__(self, attrs=None):
|
||||
choices = (
|
||||
('1', ugettext_lazy('Unknown')),
|
||||
('2', ugettext_lazy('Yes')),
|
||||
('3', ugettext_lazy('No')),
|
||||
('1', _('Unknown')),
|
||||
('2', _('Yes')),
|
||||
('3', _('No')),
|
||||
)
|
||||
super().__init__(attrs, choices)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user