diff --git a/django/contrib/admin/actions.py b/django/contrib/admin/actions.py
index 5630d1c94c..447311a47c 100644
--- a/django/contrib/admin/actions.py
+++ b/django/contrib/admin/actions.py
@@ -9,7 +9,7 @@ from django.core.exceptions import PermissionDenied
from django.db import router
from django.template.response import TemplateResponse
from django.utils.encoding import force_text
-from django.utils.translation import ugettext as _, ugettext_lazy
+from django.utils.translation import gettext as _, gettext_lazy
def delete_selected(modeladmin, request, queryset):
@@ -84,4 +84,4 @@ def delete_selected(modeladmin, request, queryset):
], context)
-delete_selected.short_description = ugettext_lazy("Delete selected %(verbose_name_plural)s")
+delete_selected.short_description = gettext_lazy("Delete selected %(verbose_name_plural)s")
diff --git a/django/contrib/admin/apps.py b/django/contrib/admin/apps.py
index 6fa406cc44..df7d669ab0 100644
--- a/django/contrib/admin/apps.py
+++ b/django/contrib/admin/apps.py
@@ -1,7 +1,7 @@
from django.apps import AppConfig
from django.contrib.admin.checks import check_admin_app, check_dependencies
from django.core import checks
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class SimpleAdminConfig(AppConfig):
diff --git a/django/contrib/admin/filters.py b/django/contrib/admin/filters.py
index f0d476ea36..a15bea9414 100644
--- a/django/contrib/admin/filters.py
+++ b/django/contrib/admin/filters.py
@@ -15,7 +15,7 @@ from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db import models
from django.utils import timezone
from django.utils.encoding import force_text
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class ListFilter:
diff --git a/django/contrib/admin/forms.py b/django/contrib/admin/forms.py
index 7c3d196012..b1f3bbe14d 100644
--- a/django/contrib/admin/forms.py
+++ b/django/contrib/admin/forms.py
@@ -1,6 +1,6 @@
from django import forms
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class AdminAuthenticationForm(AuthenticationForm):
diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py
index bc1fb5e8bd..b30dce95d2 100644
--- a/django/contrib/admin/helpers.py
+++ b/django/contrib/admin/helpers.py
@@ -13,7 +13,7 @@ from django.template.defaultfilters import capfirst, linebreaksbr
from django.utils.encoding import force_text
from django.utils.html import conditional_escape, format_html
from django.utils.safestring import mark_safe
-from django.utils.translation import ugettext, ugettext_lazy as _
+from django.utils.translation import gettext, gettext_lazy as _
ACTION_CHECKBOX_NAME = '_selected_action'
@@ -290,10 +290,10 @@ class InlineAdminFormSet:
'name': '#%s' % self.formset.prefix,
'options': {
'prefix': self.formset.prefix,
- 'addText': ugettext('Add another %(verbose_name)s') % {
+ 'addText': gettext('Add another %(verbose_name)s') % {
'verbose_name': capfirst(verbose_name),
},
- 'deleteText': ugettext('Remove'),
+ 'deleteText': gettext('Remove'),
}
})
diff --git a/django/contrib/admin/models.py b/django/contrib/admin/models.py
index 507b1d873e..ca4df1d970 100644
--- a/django/contrib/admin/models.py
+++ b/django/contrib/admin/models.py
@@ -8,7 +8,7 @@ from django.urls import NoReverseMatch, reverse
from django.utils import timezone
from django.utils.encoding import force_text
from django.utils.text import get_text_list
-from django.utils.translation import ugettext, ugettext_lazy as _
+from django.utils.translation import gettext, gettext_lazy as _
ADDITION = 1
CHANGE = 2
@@ -68,16 +68,16 @@ class LogEntry(models.Model):
def __str__(self):
if self.is_addition():
- return ugettext('Added "%(object)s".') % {'object': self.object_repr}
+ return gettext('Added "%(object)s".') % {'object': self.object_repr}
elif self.is_change():
- return ugettext('Changed "%(object)s" - %(changes)s') % {
+ return gettext('Changed "%(object)s" - %(changes)s') % {
'object': self.object_repr,
'changes': self.get_change_message(),
}
elif self.is_deletion():
- return ugettext('Deleted "%(object)s."') % {'object': self.object_repr}
+ return gettext('Deleted "%(object)s."') % {'object': self.object_repr}
- return ugettext('LogEntry Object')
+ return gettext('LogEntry Object')
def is_addition(self):
return self.action_flag == ADDITION
@@ -102,29 +102,29 @@ class LogEntry(models.Model):
for sub_message in change_message:
if 'added' in sub_message:
if sub_message['added']:
- sub_message['added']['name'] = ugettext(sub_message['added']['name'])
- messages.append(ugettext('Added {name} "{object}".').format(**sub_message['added']))
+ sub_message['added']['name'] = gettext(sub_message['added']['name'])
+ messages.append(gettext('Added {name} "{object}".').format(**sub_message['added']))
else:
- messages.append(ugettext('Added.'))
+ messages.append(gettext('Added.'))
elif 'changed' in sub_message:
sub_message['changed']['fields'] = get_text_list(
- sub_message['changed']['fields'], ugettext('and')
+ sub_message['changed']['fields'], gettext('and')
)
if 'name' in sub_message['changed']:
- sub_message['changed']['name'] = ugettext(sub_message['changed']['name'])
- messages.append(ugettext('Changed {fields} for {name} "{object}".').format(
+ sub_message['changed']['name'] = gettext(sub_message['changed']['name'])
+ messages.append(gettext('Changed {fields} for {name} "{object}".').format(
**sub_message['changed']
))
else:
- messages.append(ugettext('Changed {fields}.').format(**sub_message['changed']))
+ messages.append(gettext('Changed {fields}.').format(**sub_message['changed']))
elif 'deleted' in sub_message:
- sub_message['deleted']['name'] = ugettext(sub_message['deleted']['name'])
- messages.append(ugettext('Deleted {name} "{object}".').format(**sub_message['deleted']))
+ sub_message['deleted']['name'] = gettext(sub_message['deleted']['name'])
+ messages.append(gettext('Deleted {name} "{object}".').format(**sub_message['deleted']))
change_message = ' '.join(msg[0].upper() + msg[1:] for msg in messages)
- return change_message or ugettext('No fields changed.')
+ return change_message or gettext('No fields changed.')
else:
return self.change_message
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index c9f5ff42c1..70b2ccba21 100644
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -43,7 +43,7 @@ from django.utils.html import format_html
from django.utils.http import urlencode
from django.utils.safestring import mark_safe
from django.utils.text import capfirst, format_lazy, get_text_list
-from django.utils.translation import ugettext as _, ungettext
+from django.utils.translation import gettext as _, ngettext
from django.views.decorators.csrf import csrf_protect
from django.views.generic import RedirectView
@@ -1609,7 +1609,7 @@ class ModelAdmin(BaseModelAdmin):
changecount += 1
if changecount:
- msg = ungettext(
+ msg = ngettext(
"%(count)s %(name)s was changed successfully.",
"%(count)s %(name)s were changed successfully.",
changecount
@@ -1641,7 +1641,7 @@ class ModelAdmin(BaseModelAdmin):
else:
action_form = None
- selection_note_all = ungettext(
+ selection_note_all = ngettext(
'%(total_count)s selected',
'All %(total_count)s selected',
cl.result_count
diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
index a95bdd7a2e..868c3f27f9 100644
--- a/django/contrib/admin/sites.py
+++ b/django/contrib/admin/sites.py
@@ -10,7 +10,7 @@ from django.http import Http404, HttpResponseRedirect
from django.template.response import TemplateResponse
from django.urls import NoReverseMatch, reverse
from django.utils.text import capfirst
-from django.utils.translation import ugettext as _, ugettext_lazy
+from django.utils.translation import gettext as _, gettext_lazy
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_protect
from django.views.i18n import JavaScriptCatalog
@@ -36,13 +36,13 @@ class AdminSite:
"""
# Text to put at the end of each page's
.
- site_title = ugettext_lazy('Django site admin')
+ site_title = gettext_lazy('Django site admin')
# Text to put in each page's .
- site_header = ugettext_lazy('Django administration')
+ site_header = gettext_lazy('Django administration')
# Text to put at the top of the admin index page.
- index_title = ugettext_lazy('Site administration')
+ index_title = gettext_lazy('Site administration')
# URL for the "View site" link at the top of each admin page.
site_url = '/'
diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
index 62bbbccbed..2fd0922c5e 100644
--- a/django/contrib/admin/templatetags/admin_list.py
+++ b/django/contrib/admin/templatetags/admin_list.py
@@ -19,7 +19,7 @@ from django.utils.encoding import force_text
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.text import capfirst
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
register = Library()
diff --git a/django/contrib/admin/tests.py b/django/contrib/admin/tests.py
index ad6736f771..80ff769846 100644
--- a/django/contrib/admin/tests.py
+++ b/django/contrib/admin/tests.py
@@ -2,7 +2,7 @@ from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.test import modify_settings
from django.test.selenium import SeleniumTestCase
from django.utils.deprecation import MiddlewareMixin
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
class CSPMiddleware(MiddlewareMixin):
diff --git a/django/contrib/admin/utils.py b/django/contrib/admin/utils.py
index 6fb5d31d93..9a89f4c578 100644
--- a/django/contrib/admin/utils.py
+++ b/django/contrib/admin/utils.py
@@ -14,9 +14,7 @@ from django.utils import formats, timezone
from django.utils.encoding import force_text, smart_text
from django.utils.html import format_html
from django.utils.text import capfirst
-from django.utils.translation import (
- override as translation_override, ungettext,
-)
+from django.utils.translation import ngettext, override as translation_override
class FieldIsAForeignKeyColumnName(Exception):
@@ -271,7 +269,7 @@ def model_ngettext(obj, n=None):
obj = obj.model
d = model_format_dict(obj)
singular, plural = d["verbose_name"], d["verbose_name_plural"]
- return ungettext(singular, plural, n or 0)
+ return ngettext(singular, plural, n or 0)
def lookup_field(name, obj, model_admin=None):
diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py
index 931872ffb7..9fb65a2453 100644
--- a/django/contrib/admin/views/main.py
+++ b/django/contrib/admin/views/main.py
@@ -18,7 +18,7 @@ from django.db import models
from django.urls import reverse
from django.utils.encoding import force_text
from django.utils.http import urlencode
-from django.utils.translation import ugettext
+from django.utils.translation import gettext
# Changelist settings
ALL_VAR = 'all'
@@ -76,9 +76,9 @@ class ChangeList:
self.queryset = self.get_queryset(request)
self.get_results(request)
if self.is_popup:
- title = ugettext('Select %s')
+ title = gettext('Select %s')
else:
- title = ugettext('Select %s to change')
+ title = gettext('Select %s to change')
self.title = title % force_text(self.opts.verbose_name)
self.pk_attname = self.lookup_opts.pk.attname
diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py
index 32986b42e5..6adb20e39d 100644
--- a/django/contrib/admin/widgets.py
+++ b/django/contrib/admin/widgets.py
@@ -11,7 +11,7 @@ from django.utils.encoding import force_text
from django.utils.html import smart_urlquote
from django.utils.safestring import mark_safe
from django.utils.text import Truncator
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
class FilteredSelectMultiple(forms.SelectMultiple):
diff --git a/django/contrib/admindocs/apps.py b/django/contrib/admindocs/apps.py
index 28ddbfb92a..1a502688f7 100644
--- a/django/contrib/admindocs/apps.py
+++ b/django/contrib/admindocs/apps.py
@@ -1,5 +1,5 @@
from django.apps import AppConfig
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class AdminDocsConfig(AppConfig):
diff --git a/django/contrib/admindocs/views.py b/django/contrib/admindocs/views.py
index db95a16f99..25263ec129 100644
--- a/django/contrib/admindocs/views.py
+++ b/django/contrib/admindocs/views.py
@@ -20,7 +20,7 @@ from django.utils.inspect import (
func_accepts_kwargs, func_accepts_var_args, func_has_no_args,
get_func_full_args,
)
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from django.views.generic import TemplateView
# Exclude methods starting with these strings from documentation
diff --git a/django/contrib/auth/admin.py b/django/contrib/auth/admin.py
index e4e984fd53..2b432d75d2 100644
--- a/django/contrib/auth/admin.py
+++ b/django/contrib/auth/admin.py
@@ -16,7 +16,7 @@ from django.urls import reverse
from django.utils.decorators import method_decorator
from django.utils.encoding import force_text
from django.utils.html import escape
-from django.utils.translation import ugettext, ugettext_lazy as _
+from django.utils.translation import gettext, gettext_lazy as _
from django.views.decorators.csrf import csrf_protect
from django.views.decorators.debug import sensitive_post_parameters
@@ -144,7 +144,7 @@ class UserAdmin(admin.ModelAdmin):
form.save()
change_message = self.construct_change_message(request, form, None)
self.log_change(request, user, change_message)
- msg = ugettext('Password changed successfully.')
+ msg = gettext('Password changed successfully.')
messages.success(request, msg)
update_session_auth_hash(request, form.user)
return HttpResponseRedirect(
diff --git a/django/contrib/auth/apps.py b/django/contrib/auth/apps.py
index d5590158cf..83790007d9 100644
--- a/django/contrib/auth/apps.py
+++ b/django/contrib/auth/apps.py
@@ -1,7 +1,7 @@
from django.apps import AppConfig
from django.core import checks
from django.db.models.signals import post_migrate
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from .checks import check_models_permissions, check_user_model
from .management import create_permissions
diff --git a/django/contrib/auth/base_user.py b/django/contrib/auth/base_user.py
index de33baf3d7..63f083b908 100644
--- a/django/contrib/auth/base_user.py
+++ b/django/contrib/auth/base_user.py
@@ -11,7 +11,7 @@ from django.contrib.auth.hashers import (
from django.db import models
from django.utils.crypto import get_random_string, salted_hmac
from django.utils.encoding import force_text
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class BaseUserManager(models.Manager):
diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py
index 33b247b4c2..25835dad24 100644
--- a/django/contrib/auth/forms.py
+++ b/django/contrib/auth/forms.py
@@ -15,7 +15,7 @@ from django.template import loader
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode
from django.utils.text import capfirst
-from django.utils.translation import ugettext, ugettext_lazy as _
+from django.utils.translation import gettext, gettext_lazy as _
UserModel = get_user_model()
@@ -27,15 +27,15 @@ class ReadOnlyPasswordHashWidget(forms.Widget):
context = super().get_context(name, value, attrs)
summary = []
if not value or value.startswith(UNUSABLE_PASSWORD_PREFIX):
- summary.append({'label': ugettext("No password set.")})
+ summary.append({'label': gettext("No password set.")})
else:
try:
hasher = identify_hasher(value)
except ValueError:
- summary.append({'label': ugettext("Invalid password format or unknown hashing algorithm.")})
+ summary.append({'label': gettext("Invalid password format or unknown hashing algorithm.")})
else:
for key, value_ in hasher.safe_summary(value).items():
- summary.append({'label': ugettext(key), 'value': value_})
+ summary.append({'label': gettext(key), 'value': value_})
context['summary'] = summary
return context
diff --git a/django/contrib/auth/hashers.py b/django/contrib/auth/hashers.py
index fa31fa0e55..c14ece20fb 100644
--- a/django/contrib/auth/hashers.py
+++ b/django/contrib/auth/hashers.py
@@ -15,7 +15,7 @@ from django.utils.crypto import (
)
from django.utils.encoding import force_bytes, force_text
from django.utils.module_loading import import_string
-from django.utils.translation import ugettext_noop as _
+from django.utils.translation import gettext_noop as _
UNUSABLE_PASSWORD_PREFIX = '!' # This will never be a valid encoded hash
UNUSABLE_PASSWORD_SUFFIX_LENGTH = 40 # number of random chars to add after UNUSABLE_PASSWORD_PREFIX
diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py
index df4fcf4aa7..dad7d288c5 100644
--- a/django/contrib/auth/models.py
+++ b/django/contrib/auth/models.py
@@ -7,7 +7,7 @@ from django.core.mail import send_mail
from django.db import models
from django.db.models.manager import EmptyManager
from django.utils import timezone
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from .validators import UnicodeUsernameValidator
diff --git a/django/contrib/auth/password_validation.py b/django/contrib/auth/password_validation.py
index 23b2b6f185..aa2233e779 100644
--- a/django/contrib/auth/password_validation.py
+++ b/django/contrib/auth/password_validation.py
@@ -12,7 +12,7 @@ from django.utils.encoding import force_text
from django.utils.functional import lazy
from django.utils.html import format_html
from django.utils.module_loading import import_string
-from django.utils.translation import ugettext as _, ungettext
+from django.utils.translation import gettext as _, ngettext
@functools.lru_cache(maxsize=None)
@@ -99,7 +99,7 @@ class MinimumLengthValidator:
def validate(self, password, user=None):
if len(password) < self.min_length:
raise ValidationError(
- ungettext(
+ ngettext(
"This password is too short. It must contain at least %(min_length)d character.",
"This password is too short. It must contain at least %(min_length)d characters.",
self.min_length
@@ -109,7 +109,7 @@ class MinimumLengthValidator:
)
def get_help_text(self):
- return ungettext(
+ return ngettext(
"Your password must contain at least %(min_length)d character.",
"Your password must contain at least %(min_length)d characters.",
self.min_length
diff --git a/django/contrib/auth/validators.py b/django/contrib/auth/validators.py
index d8083de809..b4878cfd45 100644
--- a/django/contrib/auth/validators.py
+++ b/django/contrib/auth/validators.py
@@ -2,7 +2,7 @@ import re
from django.core import validators
from django.utils.deconstruct import deconstructible
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
@deconstructible
diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py
index e629a70240..b2c37ebdb7 100644
--- a/django/contrib/auth/views.py
+++ b/django/contrib/auth/views.py
@@ -21,7 +21,7 @@ from django.utils.decorators import method_decorator
from django.utils.deprecation import RemovedInDjango21Warning
from django.utils.encoding import force_text
from django.utils.http import is_safe_url, urlsafe_base64_decode
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_protect
from django.views.decorators.debug import sensitive_post_parameters
diff --git a/django/contrib/contenttypes/apps.py b/django/contrib/contenttypes/apps.py
index 5754f8c24c..095dbf5615 100644
--- a/django/contrib/contenttypes/apps.py
+++ b/django/contrib/contenttypes/apps.py
@@ -2,7 +2,7 @@ from django.apps import AppConfig
from django.contrib.contenttypes.checks import check_generic_foreign_keys
from django.core import checks
from django.db.models.signals import post_migrate, pre_migrate
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from .management import (
create_contenttypes, inject_rename_contenttypes_operations,
diff --git a/django/contrib/contenttypes/models.py b/django/contrib/contenttypes/models.py
index 20347082ae..4b9bcdc3ba 100644
--- a/django/contrib/contenttypes/models.py
+++ b/django/contrib/contenttypes/models.py
@@ -3,7 +3,7 @@ from collections import defaultdict
from django.apps import apps
from django.db import models
from django.utils.encoding import force_text
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class ContentTypeManager(models.Manager):
diff --git a/django/contrib/contenttypes/views.py b/django/contrib/contenttypes/views.py
index 50c07d1109..006a450973 100644
--- a/django/contrib/contenttypes/views.py
+++ b/django/contrib/contenttypes/views.py
@@ -3,7 +3,7 @@ from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.requests import RequestSite
from django.core.exceptions import ObjectDoesNotExist
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
def shortcut(request, content_type_id, object_id):
diff --git a/django/contrib/flatpages/admin.py b/django/contrib/flatpages/admin.py
index d8c4eae1af..ead6b52b50 100644
--- a/django/contrib/flatpages/admin.py
+++ b/django/contrib/flatpages/admin.py
@@ -1,7 +1,7 @@
from django.contrib import admin
from django.contrib.flatpages.forms import FlatpageForm
from django.contrib.flatpages.models import FlatPage
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
@admin.register(FlatPage)
diff --git a/django/contrib/flatpages/apps.py b/django/contrib/flatpages/apps.py
index ac966c81f5..330ee05063 100644
--- a/django/contrib/flatpages/apps.py
+++ b/django/contrib/flatpages/apps.py
@@ -1,5 +1,5 @@
from django.apps import AppConfig
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class FlatPagesConfig(AppConfig):
diff --git a/django/contrib/flatpages/forms.py b/django/contrib/flatpages/forms.py
index 3933df8e4e..d807def77d 100644
--- a/django/contrib/flatpages/forms.py
+++ b/django/contrib/flatpages/forms.py
@@ -1,7 +1,7 @@
from django import forms
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
-from django.utils.translation import ugettext, ugettext_lazy as _
+from django.utils.translation import gettext, gettext_lazy as _
class FlatpageForm(forms.ModelForm):
@@ -26,14 +26,14 @@ class FlatpageForm(forms.ModelForm):
url = self.cleaned_data['url']
if not url.startswith('/'):
raise forms.ValidationError(
- ugettext("URL is missing a leading slash."),
+ gettext("URL is missing a leading slash."),
code='missing_leading_slash',
)
if (settings.APPEND_SLASH and
'django.middleware.common.CommonMiddleware' in settings.MIDDLEWARE and
not url.endswith('/')):
raise forms.ValidationError(
- ugettext("URL is missing a trailing slash."),
+ gettext("URL is missing a trailing slash."),
code='missing_trailing_slash',
)
return url
diff --git a/django/contrib/flatpages/models.py b/django/contrib/flatpages/models.py
index 38cc9fd0fe..32e4fd1123 100644
--- a/django/contrib/flatpages/models.py
+++ b/django/contrib/flatpages/models.py
@@ -2,7 +2,7 @@ from django.contrib.sites.models import Site
from django.db import models
from django.urls import get_script_prefix
from django.utils.encoding import iri_to_uri
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class FlatPage(models.Model):
diff --git a/django/contrib/gis/apps.py b/django/contrib/gis/apps.py
index 919272b064..ffbbe63273 100644
--- a/django/contrib/gis/apps.py
+++ b/django/contrib/gis/apps.py
@@ -1,6 +1,6 @@
from django.apps import AppConfig
from django.core import serializers
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class GISConfig(AppConfig):
diff --git a/django/contrib/gis/db/models/fields.py b/django/contrib/gis/db/models/fields.py
index f7ca59e701..f63190e9a9 100644
--- a/django/contrib/gis/db/models/fields.py
+++ b/django/contrib/gis/db/models/fields.py
@@ -10,7 +10,7 @@ from django.contrib.gis.geometry.backend import Geometry, GeometryException
from django.core.exceptions import ImproperlyConfigured
from django.db.models.expressions import Expression
from django.db.models.fields import Field
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
# Local cache of the spatial_ref_sys table, which holds SRID data for each
# spatial database alias. This cache exists so that the database isn't queried
diff --git a/django/contrib/gis/forms/fields.py b/django/contrib/gis/forms/fields.py
index 601dd806d9..afb0974415 100644
--- a/django/contrib/gis/forms/fields.py
+++ b/django/contrib/gis/forms/fields.py
@@ -1,6 +1,6 @@
from django import forms
from django.contrib.gis.geos import GEOSException, GEOSGeometry
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from .widgets import OpenLayersWidget
diff --git a/django/contrib/gis/views.py b/django/contrib/gis/views.py
index db0fa3d53d..35d2b6b695 100644
--- a/django/contrib/gis/views.py
+++ b/django/contrib/gis/views.py
@@ -1,5 +1,5 @@
from django.http import Http404
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
def feed(request, url, feed_dict=None):
diff --git a/django/contrib/humanize/apps.py b/django/contrib/humanize/apps.py
index c518ee12df..c5fcbca794 100644
--- a/django/contrib/humanize/apps.py
+++ b/django/contrib/humanize/apps.py
@@ -1,5 +1,5 @@
from django.apps import AppConfig
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class HumanizeConfig(AppConfig):
diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py
index 60cbd884ba..d00f597ea8 100644
--- a/django/contrib/humanize/templatetags/humanize.py
+++ b/django/contrib/humanize/templatetags/humanize.py
@@ -9,7 +9,7 @@ from django.utils.encoding import force_text
from django.utils.formats import number_format
from django.utils.safestring import mark_safe
from django.utils.timezone import is_aware, utc
-from django.utils.translation import pgettext, ugettext as _, ungettext
+from django.utils.translation import gettext as _, ngettext, pgettext
register = template.Library()
@@ -56,48 +56,48 @@ def intcomma(value, use_l10n=True):
# A tuple of standard large number to their converters
intword_converters = (
(6, lambda number: (
- ungettext('%(value).1f million', '%(value).1f million', number),
- ungettext('%(value)s million', '%(value)s million', number),
+ ngettext('%(value).1f million', '%(value).1f million', number),
+ ngettext('%(value)s million', '%(value)s million', number),
)),
(9, lambda number: (
- ungettext('%(value).1f billion', '%(value).1f billion', number),
- ungettext('%(value)s billion', '%(value)s billion', number),
+ ngettext('%(value).1f billion', '%(value).1f billion', number),
+ ngettext('%(value)s billion', '%(value)s billion', number),
)),
(12, lambda number: (
- ungettext('%(value).1f trillion', '%(value).1f trillion', number),
- ungettext('%(value)s trillion', '%(value)s trillion', number),
+ ngettext('%(value).1f trillion', '%(value).1f trillion', number),
+ ngettext('%(value)s trillion', '%(value)s trillion', number),
)),
(15, lambda number: (
- ungettext('%(value).1f quadrillion', '%(value).1f quadrillion', number),
- ungettext('%(value)s quadrillion', '%(value)s quadrillion', number),
+ ngettext('%(value).1f quadrillion', '%(value).1f quadrillion', number),
+ ngettext('%(value)s quadrillion', '%(value)s quadrillion', number),
)),
(18, lambda number: (
- ungettext('%(value).1f quintillion', '%(value).1f quintillion', number),
- ungettext('%(value)s quintillion', '%(value)s quintillion', number),
+ ngettext('%(value).1f quintillion', '%(value).1f quintillion', number),
+ ngettext('%(value)s quintillion', '%(value)s quintillion', number),
)),
(21, lambda number: (
- ungettext('%(value).1f sextillion', '%(value).1f sextillion', number),
- ungettext('%(value)s sextillion', '%(value)s sextillion', number),
+ ngettext('%(value).1f sextillion', '%(value).1f sextillion', number),
+ ngettext('%(value)s sextillion', '%(value)s sextillion', number),
)),
(24, lambda number: (
- ungettext('%(value).1f septillion', '%(value).1f septillion', number),
- ungettext('%(value)s septillion', '%(value)s septillion', number),
+ ngettext('%(value).1f septillion', '%(value).1f septillion', number),
+ ngettext('%(value)s septillion', '%(value)s septillion', number),
)),
(27, lambda number: (
- ungettext('%(value).1f octillion', '%(value).1f octillion', number),
- ungettext('%(value)s octillion', '%(value)s octillion', number),
+ ngettext('%(value).1f octillion', '%(value).1f octillion', number),
+ ngettext('%(value)s octillion', '%(value)s octillion', number),
)),
(30, lambda number: (
- ungettext('%(value).1f nonillion', '%(value).1f nonillion', number),
- ungettext('%(value)s nonillion', '%(value)s nonillion', number),
+ ngettext('%(value).1f nonillion', '%(value).1f nonillion', number),
+ ngettext('%(value)s nonillion', '%(value)s nonillion', number),
)),
(33, lambda number: (
- ungettext('%(value).1f decillion', '%(value).1f decillion', number),
- ungettext('%(value)s decillion', '%(value)s decillion', number),
+ ngettext('%(value).1f decillion', '%(value).1f decillion', number),
+ ngettext('%(value)s decillion', '%(value)s decillion', number),
)),
(100, lambda number: (
- ungettext('%(value).1f googol', '%(value).1f googol', number),
- ungettext('%(value)s googol', '%(value)s googol', number),
+ ngettext('%(value).1f googol', '%(value).1f googol', number),
+ ngettext('%(value)s googol', '%(value)s googol', number),
)),
)
@@ -202,21 +202,21 @@ def naturaltime(value):
elif delta.seconds == 0:
return _('now')
elif delta.seconds < 60:
- return ungettext(
+ return ngettext(
# Translators: please keep a non-breaking space (U+00A0)
# between count and time unit.
'a second ago', '%(count)s seconds ago', delta.seconds
) % {'count': delta.seconds}
elif delta.seconds // 60 < 60:
count = delta.seconds // 60
- return ungettext(
+ return ngettext(
# Translators: please keep a non-breaking space (U+00A0)
# between count and time unit.
'a minute ago', '%(count)s minutes ago', count
) % {'count': count}
else:
count = delta.seconds // 60 // 60
- return ungettext(
+ return ngettext(
# Translators: please keep a non-breaking space (U+00A0)
# between count and time unit.
'an hour ago', '%(count)s hours ago', count
@@ -230,21 +230,21 @@ def naturaltime(value):
elif delta.seconds == 0:
return _('now')
elif delta.seconds < 60:
- return ungettext(
+ return ngettext(
# Translators: please keep a non-breaking space (U+00A0)
# between count and time unit.
'a second from now', '%(count)s seconds from now', delta.seconds
) % {'count': delta.seconds}
elif delta.seconds // 60 < 60:
count = delta.seconds // 60
- return ungettext(
+ return ngettext(
# Translators: please keep a non-breaking space (U+00A0)
# between count and time unit.
'a minute from now', '%(count)s minutes from now', count
) % {'count': count}
else:
count = delta.seconds // 60 // 60
- return ungettext(
+ return ngettext(
# Translators: please keep a non-breaking space (U+00A0)
# between count and time unit.
'an hour from now', '%(count)s hours from now', count
diff --git a/django/contrib/messages/apps.py b/django/contrib/messages/apps.py
index de48c8aa4d..0ff25d3885 100644
--- a/django/contrib/messages/apps.py
+++ b/django/contrib/messages/apps.py
@@ -1,5 +1,5 @@
from django.apps import AppConfig
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class MessagesConfig(AppConfig):
diff --git a/django/contrib/postgres/apps.py b/django/contrib/postgres/apps.py
index 0eeee6332b..6ed8dc8626 100644
--- a/django/contrib/postgres/apps.py
+++ b/django/contrib/postgres/apps.py
@@ -2,7 +2,7 @@ from django.apps import AppConfig
from django.db import connections
from django.db.backends.signals import connection_created
from django.db.models import CharField, TextField
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from .lookups import SearchLookup, TrigramSimilar, Unaccent
from .signals import register_hstore_handler
diff --git a/django/contrib/postgres/fields/array.py b/django/contrib/postgres/fields/array.py
index 15cbf5e45e..18050e9a56 100644
--- a/django/contrib/postgres/fields/array.py
+++ b/django/contrib/postgres/fields/array.py
@@ -6,7 +6,7 @@ from django.contrib.postgres.validators import ArrayMaxLengthValidator
from django.core import checks, exceptions
from django.db.models import Field, IntegerField, Transform
from django.db.models.lookups import Exact, In
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from ..utils import prefix_validation_error
from .utils import AttributeSetter
diff --git a/django/contrib/postgres/fields/hstore.py b/django/contrib/postgres/fields/hstore.py
index 28b7c19c7d..e0226a8d4a 100644
--- a/django/contrib/postgres/fields/hstore.py
+++ b/django/contrib/postgres/fields/hstore.py
@@ -5,7 +5,7 @@ from django.contrib.postgres.fields.array import ArrayField
from django.core import exceptions
from django.db.models import Field, TextField, Transform
from django.utils.encoding import force_text
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
__all__ = ['HStoreField']
diff --git a/django/contrib/postgres/fields/jsonb.py b/django/contrib/postgres/fields/jsonb.py
index 0bb6e7bed1..a3a3381745 100644
--- a/django/contrib/postgres/fields/jsonb.py
+++ b/django/contrib/postgres/fields/jsonb.py
@@ -7,7 +7,7 @@ from django.core import exceptions
from django.db.models import (
Field, TextField, Transform, lookups as builtin_lookups,
)
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
__all__ = ['JSONField']
diff --git a/django/contrib/postgres/forms/array.py b/django/contrib/postgres/forms/array.py
index d9d864e4f2..303b46dfb2 100644
--- a/django/contrib/postgres/forms/array.py
+++ b/django/contrib/postgres/forms/array.py
@@ -7,7 +7,7 @@ from django.contrib.postgres.validators import (
)
from django.core.exceptions import ValidationError
from django.utils.safestring import mark_safe
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from ..utils import prefix_validation_error
diff --git a/django/contrib/postgres/forms/hstore.py b/django/contrib/postgres/forms/hstore.py
index 7e046ead37..984227ff71 100644
--- a/django/contrib/postgres/forms/hstore.py
+++ b/django/contrib/postgres/forms/hstore.py
@@ -2,7 +2,7 @@ import json
from django import forms
from django.core.exceptions import ValidationError
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
__all__ = ['HStoreField']
diff --git a/django/contrib/postgres/forms/jsonb.py b/django/contrib/postgres/forms/jsonb.py
index 28429c7172..2cb6092cb7 100644
--- a/django/contrib/postgres/forms/jsonb.py
+++ b/django/contrib/postgres/forms/jsonb.py
@@ -1,7 +1,7 @@
import json
from django import forms
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
__all__ = ['JSONField']
diff --git a/django/contrib/postgres/forms/ranges.py b/django/contrib/postgres/forms/ranges.py
index 5be166f7d0..d966a6e1db 100644
--- a/django/contrib/postgres/forms/ranges.py
+++ b/django/contrib/postgres/forms/ranges.py
@@ -3,7 +3,7 @@ from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange
from django import forms
from django.core import exceptions
from django.forms.widgets import MultiWidget
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
__all__ = ['IntegerRangeField', 'FloatRangeField', 'DateTimeRangeField', 'DateRangeField']
diff --git a/django/contrib/postgres/utils.py b/django/contrib/postgres/utils.py
index a87d519477..7c3a0d5e33 100644
--- a/django/contrib/postgres/utils.py
+++ b/django/contrib/postgres/utils.py
@@ -14,7 +14,7 @@ def prefix_validation_error(error, prefix, code, params):
# We can't simply concatenate messages since they might require
# their associated parameters to be expressed correctly which
# is not something `format_lazy` does. For example, proxied
- # ungettext calls require a count parameter and are converted
+ # ngettext calls require a count parameter and are converted
# to an empty string if they are missing it.
message=format_lazy(
'{}{}',
diff --git a/django/contrib/postgres/validators.py b/django/contrib/postgres/validators.py
index a1aef12015..9d256d8d83 100644
--- a/django/contrib/postgres/validators.py
+++ b/django/contrib/postgres/validators.py
@@ -6,18 +6,18 @@ from django.core.validators import (
MinValueValidator,
)
from django.utils.deconstruct import deconstructible
-from django.utils.translation import ugettext_lazy as _, ungettext_lazy
+from django.utils.translation import gettext_lazy as _, ngettext_lazy
class ArrayMaxLengthValidator(MaxLengthValidator):
- message = ungettext_lazy(
+ message = ngettext_lazy(
'List contains %(show_value)d item, it should contain no more than %(limit_value)d.',
'List contains %(show_value)d items, it should contain no more than %(limit_value)d.',
'limit_value')
class ArrayMinLengthValidator(MinLengthValidator):
- message = ungettext_lazy(
+ message = ngettext_lazy(
'List contains %(show_value)d item, it should contain no fewer than %(limit_value)d.',
'List contains %(show_value)d items, it should contain no fewer than %(limit_value)d.',
'limit_value')
diff --git a/django/contrib/redirects/apps.py b/django/contrib/redirects/apps.py
index f09437ed00..cab67424e7 100644
--- a/django/contrib/redirects/apps.py
+++ b/django/contrib/redirects/apps.py
@@ -1,5 +1,5 @@
from django.apps import AppConfig
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class RedirectsConfig(AppConfig):
diff --git a/django/contrib/redirects/models.py b/django/contrib/redirects/models.py
index 7a876ec76b..819aa331dd 100644
--- a/django/contrib/redirects/models.py
+++ b/django/contrib/redirects/models.py
@@ -1,6 +1,6 @@
from django.contrib.sites.models import Site
from django.db import models
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class Redirect(models.Model):
diff --git a/django/contrib/sessions/apps.py b/django/contrib/sessions/apps.py
index 1e75a6fff8..8b778d1109 100644
--- a/django/contrib/sessions/apps.py
+++ b/django/contrib/sessions/apps.py
@@ -1,5 +1,5 @@
from django.apps import AppConfig
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class SessionsConfig(AppConfig):
diff --git a/django/contrib/sessions/base_session.py b/django/contrib/sessions/base_session.py
index e9cdcfe1c6..1d653b5adf 100644
--- a/django/contrib/sessions/base_session.py
+++ b/django/contrib/sessions/base_session.py
@@ -3,7 +3,7 @@ This module allows importing AbstractBaseSession even
when django.contrib.sessions is not in INSTALLED_APPS.
"""
from django.db import models
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class BaseSessionManager(models.Manager):
diff --git a/django/contrib/sitemaps/apps.py b/django/contrib/sitemaps/apps.py
index e2abc70e24..502d6890d0 100644
--- a/django/contrib/sitemaps/apps.py
+++ b/django/contrib/sitemaps/apps.py
@@ -1,5 +1,5 @@
from django.apps import AppConfig
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class SiteMapsConfig(AppConfig):
diff --git a/django/contrib/sites/apps.py b/django/contrib/sites/apps.py
index 7d319e0199..c4598049c5 100644
--- a/django/contrib/sites/apps.py
+++ b/django/contrib/sites/apps.py
@@ -1,6 +1,6 @@
from django.apps import AppConfig
from django.db.models.signals import post_migrate
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from .management import create_default_site
diff --git a/django/contrib/sites/models.py b/django/contrib/sites/models.py
index b028342a84..19f52e4487 100644
--- a/django/contrib/sites/models.py
+++ b/django/contrib/sites/models.py
@@ -4,7 +4,7 @@ from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db import models
from django.db.models.signals import pre_delete, pre_save
from django.http.request import split_domain_port
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
SITE_CACHE = {}
diff --git a/django/contrib/staticfiles/apps.py b/django/contrib/staticfiles/apps.py
index 65865da0d2..adf9f7e57d 100644
--- a/django/contrib/staticfiles/apps.py
+++ b/django/contrib/staticfiles/apps.py
@@ -1,7 +1,7 @@
from django.apps import AppConfig
from django.contrib.staticfiles.checks import check_finders
from django.core import checks
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class StaticFilesConfig(AppConfig):
diff --git a/django/contrib/syndication/apps.py b/django/contrib/syndication/apps.py
index 27bda578a4..b3f7c6cd61 100644
--- a/django/contrib/syndication/apps.py
+++ b/django/contrib/syndication/apps.py
@@ -1,5 +1,5 @@
from django.apps import AppConfig
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class SyndicationConfig(AppConfig):
diff --git a/django/core/paginator.py b/django/core/paginator.py
index abc29b3603..e0e78bf020 100644
--- a/django/core/paginator.py
+++ b/django/core/paginator.py
@@ -3,7 +3,7 @@ import warnings
from math import ceil
from django.utils.functional import cached_property
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class UnorderedObjectListWarning(RuntimeWarning):
diff --git a/django/core/validators.py b/django/core/validators.py
index 365c6a7f15..44db6c00f0 100644
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -8,7 +8,7 @@ from django.utils.deconstruct import deconstructible
from django.utils.encoding import force_text
from django.utils.functional import SimpleLazyObject
from django.utils.ipv6 import is_valid_ipv6_address
-from django.utils.translation import ugettext_lazy as _, ungettext_lazy
+from django.utils.translation import gettext_lazy as _, ngettext_lazy
# These values, if given to validate(), will trigger the self.required check.
EMPTY_VALUES = (None, '', [], (), {})
@@ -359,7 +359,7 @@ class MinValueValidator(BaseValidator):
@deconstructible
class MinLengthValidator(BaseValidator):
- message = ungettext_lazy(
+ message = ngettext_lazy(
'Ensure this value has at least %(limit_value)d character (it has %(show_value)d).',
'Ensure this value has at least %(limit_value)d characters (it has %(show_value)d).',
'limit_value')
@@ -374,7 +374,7 @@ class MinLengthValidator(BaseValidator):
@deconstructible
class MaxLengthValidator(BaseValidator):
- message = ungettext_lazy(
+ message = ngettext_lazy(
'Ensure this value has at most %(limit_value)d character (it has %(show_value)d).',
'Ensure this value has at most %(limit_value)d characters (it has %(show_value)d).',
'limit_value')
@@ -394,17 +394,17 @@ class DecimalValidator:
expected, otherwise raise ValidationError.
"""
messages = {
- 'max_digits': ungettext_lazy(
+ 'max_digits': ngettext_lazy(
'Ensure that there are no more than %(max)s digit in total.',
'Ensure that there are no more than %(max)s digits in total.',
'max'
),
- 'max_decimal_places': ungettext_lazy(
+ 'max_decimal_places': ngettext_lazy(
'Ensure that there are no more than %(max)s decimal place.',
'Ensure that there are no more than %(max)s decimal places.',
'max'
),
- 'max_whole_digits': ungettext_lazy(
+ 'max_whole_digits': ngettext_lazy(
'Ensure that there are no more than %(max)s digit before the decimal point.',
'Ensure that there are no more than %(max)s digits before the decimal point.',
'max'
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 2914ba2a6f..cf3c3f0584 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -29,7 +29,7 @@ from django.db.models.utils import make_model_tuple
from django.utils.encoding import force_text
from django.utils.functional import curry
from django.utils.text import capfirst, get_text_list
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from django.utils.version import get_version
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index 68a42f0236..527ed8e423 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -30,7 +30,7 @@ from django.utils.functional import Promise, cached_property, curry
from django.utils.ipv6 import clean_ipv6_address
from django.utils.itercompat import is_iterable
from django.utils.text import capfirst
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
__all__ = [
'AutoField', 'BLANK_CHOICE_DASH', 'BigAutoField', 'BigIntegerField',
diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py
index 0e9ec19e70..95249dee53 100644
--- a/django/db/models/fields/files.py
+++ b/django/db/models/fields/files.py
@@ -10,7 +10,7 @@ from django.core.validators import validate_image_file_extension
from django.db.models import signals
from django.db.models.fields import Field
from django.utils.encoding import force_text
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class FieldFile(File):
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index cf39de7287..94c4cc81b9 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -14,7 +14,7 @@ from django.db.models.query_utils import PathInfo
from django.db.models.utils import make_model_tuple
from django.utils.encoding import force_text
from django.utils.functional import cached_property, curry
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from . import Field
from .related_descriptors import (
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py
index 8bed2a8a52..dc34958777 100644
--- a/django/forms/boundfield.py
+++ b/django/forms/boundfield.py
@@ -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',)
diff --git a/django/forms/fields.py b/django/forms/fields.py
index 13899c3ab1..9d5a8cf353 100644
--- a/django/forms/fields.py
+++ b/django/forms/fields.py
@@ -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'),
diff --git a/django/forms/forms.py b/django/forms/forms.py
index 5770f6d609..99c2f03558 100644
--- a/django/forms/forms.py
+++ b/django/forms/forms.py
@@ -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
diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index 4d8259c2c5..60feb618db 100644
--- a/django/forms/formsets.py
+++ b/django/forms/formsets.py
@@ -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')
diff --git a/django/forms/models.py b/django/forms/models.py
index 0368839415..cf4775169e 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -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 = []
diff --git a/django/forms/utils.py b/django/forms/utils.py
index bda4694e4f..e096f8393e 100644
--- a/django/forms/utils.py
+++ b/django/forms/utils.py
@@ -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):
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 38ed56950a..c468e7d799 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -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)
diff --git a/django/template/base.py b/django/template/base.py
index 51e78635de..163ea3043d 100644
--- a/django/template/base.py
+++ b/django/template/base.py
@@ -65,7 +65,7 @@ from django.utils.text import (
get_text_list, smart_split, unescape_string_literal,
)
from django.utils.timezone import template_localtime
-from django.utils.translation import pgettext_lazy, ugettext_lazy
+from django.utils.translation import gettext_lazy, pgettext_lazy
from .exceptions import TemplateSyntaxError
@@ -824,7 +824,7 @@ class Variable:
if self.message_context:
return pgettext_lazy(self.message_context, msgid)
else:
- return ugettext_lazy(msgid)
+ return gettext_lazy(msgid)
return value
def __repr__(self):
diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py
index 5a2413d22d..09064569eb 100644
--- a/django/template/defaultfilters.py
+++ b/django/template/defaultfilters.py
@@ -19,7 +19,7 @@ from django.utils.text import (
Truncator, normalize_newlines, phone2numeric, slugify as _slugify, wrap,
)
from django.utils.timesince import timesince, timeuntil
-from django.utils.translation import ugettext, ungettext
+from django.utils.translation import gettext, ngettext
from .base import Variable, VariableDoesNotExist
from .library import Library
@@ -817,7 +817,7 @@ def yesno(value, arg=None):
========== ====================== ==================================
"""
if arg is None:
- arg = ugettext('yes,no,maybe')
+ arg = gettext('yes,no,maybe')
bits = arg.split(',')
if len(bits) < 2:
return value # Invalid arg.
@@ -846,7 +846,7 @@ def filesizeformat(bytes_):
try:
bytes_ = float(bytes_)
except (TypeError, ValueError, UnicodeDecodeError):
- value = ungettext("%(size)d byte", "%(size)d bytes", 0) % {'size': 0}
+ value = ngettext("%(size)d byte", "%(size)d bytes", 0) % {'size': 0}
return avoid_wrapping(value)
def filesize_number_format(value):
@@ -863,17 +863,17 @@ def filesizeformat(bytes_):
bytes_ = -bytes_ # Allow formatting of negative numbers.
if bytes_ < KB:
- value = ungettext("%(size)d byte", "%(size)d bytes", bytes_) % {'size': bytes_}
+ value = ngettext("%(size)d byte", "%(size)d bytes", bytes_) % {'size': bytes_}
elif bytes_ < MB:
- value = ugettext("%s KB") % filesize_number_format(bytes_ / KB)
+ value = gettext("%s KB") % filesize_number_format(bytes_ / KB)
elif bytes_ < GB:
- value = ugettext("%s MB") % filesize_number_format(bytes_ / MB)
+ value = gettext("%s MB") % filesize_number_format(bytes_ / MB)
elif bytes_ < TB:
- value = ugettext("%s GB") % filesize_number_format(bytes_ / GB)
+ value = gettext("%s GB") % filesize_number_format(bytes_ / GB)
elif bytes_ < PB:
- value = ugettext("%s TB") % filesize_number_format(bytes_ / TB)
+ value = gettext("%s TB") % filesize_number_format(bytes_ / TB)
else:
- value = ugettext("%s PB") % filesize_number_format(bytes_ / PB)
+ value = gettext("%s PB") % filesize_number_format(bytes_ / PB)
if negative:
value = "-%s" % value
diff --git a/django/templatetags/i18n.py b/django/templatetags/i18n.py
index 456c5071ac..8627bf4331 100644
--- a/django/templatetags/i18n.py
+++ b/django/templatetags/i18n.py
@@ -13,7 +13,7 @@ class GetAvailableLanguagesNode(Node):
self.variable = variable
def render(self, context):
- context[self.variable] = [(k, translation.ugettext(v)) for k, v in settings.LANGUAGES]
+ context[self.variable] = [(k, translation.gettext(v)) for k, v in settings.LANGUAGES]
return ''
@@ -142,13 +142,13 @@ class BlockTranslateNode(Node):
result = translation.npgettext(message_context, singular,
plural, count)
else:
- result = translation.ungettext(singular, plural, count)
+ result = translation.ngettext(singular, plural, count)
vars.extend(plural_vars)
else:
if message_context:
result = translation.pgettext(message_context, singular)
else:
- result = translation.ugettext(singular)
+ result = translation.gettext(singular)
default_value = context.template.engine.string_if_invalid
def render_value(key):
@@ -267,7 +267,7 @@ def language_name(lang_code):
@register.filter
def language_name_translated(lang_code):
english_name = translation.get_language_info(lang_code)['name']
- return translation.ugettext(english_name)
+ return translation.gettext(english_name)
@register.filter
diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py
index e71744ead7..9b8462903e 100644
--- a/django/urls/resolvers.py
+++ b/django/urls/resolvers.py
@@ -114,7 +114,7 @@ class LocaleRegexProvider:
"""
def __init__(self, regex):
# regex is either a string representing a regular expression, or a
- # translatable string (using ugettext_lazy) representing a regular
+ # translatable string (using gettext_lazy) representing a regular
# expression.
self._regex = regex
self._regex_dict = {}
diff --git a/django/utils/dateformat.py b/django/utils/dateformat.py
index 74c4b894d3..1deee1c377 100644
--- a/django/utils/dateformat.py
+++ b/django/utils/dateformat.py
@@ -20,7 +20,7 @@ from django.utils.dates import (
)
from django.utils.encoding import force_text
from django.utils.timezone import get_default_timezone, is_aware, is_naive
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
re_formatchars = re.compile(r'(?>> get_text_list(['a', 'b', 'c', 'd'])
'a, b, c or d'
diff --git a/django/utils/timesince.py b/django/utils/timesince.py
index f87d958f4f..4dcafa521d 100644
--- a/django/utils/timesince.py
+++ b/django/utils/timesince.py
@@ -3,15 +3,15 @@ import datetime
from django.utils.html import avoid_wrapping
from django.utils.timezone import is_aware, utc
-from django.utils.translation import ugettext, ungettext_lazy
+from django.utils.translation import gettext, ngettext_lazy
TIMESINCE_CHUNKS = (
- (60 * 60 * 24 * 365, ungettext_lazy('%d year', '%d years')),
- (60 * 60 * 24 * 30, ungettext_lazy('%d month', '%d months')),
- (60 * 60 * 24 * 7, ungettext_lazy('%d week', '%d weeks')),
- (60 * 60 * 24, ungettext_lazy('%d day', '%d days')),
- (60 * 60, ungettext_lazy('%d hour', '%d hours')),
- (60, ungettext_lazy('%d minute', '%d minutes'))
+ (60 * 60 * 24 * 365, ngettext_lazy('%d year', '%d years')),
+ (60 * 60 * 24 * 30, ngettext_lazy('%d month', '%d months')),
+ (60 * 60 * 24 * 7, ngettext_lazy('%d week', '%d weeks')),
+ (60 * 60 * 24, ngettext_lazy('%d day', '%d days')),
+ (60 * 60, ngettext_lazy('%d hour', '%d hours')),
+ (60, ngettext_lazy('%d minute', '%d minutes'))
)
@@ -55,7 +55,7 @@ def timesince(d, now=None, reversed=False):
since = delta.days * 24 * 60 * 60 + delta.seconds
if since <= 0:
# d is in the future compared to now, stop processing.
- return avoid_wrapping(ugettext('0 minutes'))
+ return avoid_wrapping(gettext('0 minutes'))
for i, (seconds, name) in enumerate(TIMESINCE_CHUNKS):
count = since // seconds
if count != 0:
@@ -66,7 +66,7 @@ def timesince(d, now=None, reversed=False):
seconds2, name2 = TIMESINCE_CHUNKS[i + 1]
count2 = (since - (seconds * count)) // seconds2
if count2 != 0:
- result += ugettext(', ') + avoid_wrapping(name2 % count2)
+ result += gettext(', ') + avoid_wrapping(name2 % count2)
return result
diff --git a/django/utils/translation/__init__.py b/django/utils/translation/__init__.py
index 8728084f90..dc4936a976 100644
--- a/django/utils/translation/__init__.py
+++ b/django/utils/translation/__init__.py
@@ -250,7 +250,7 @@ def get_language_info(lang_code):
raise KeyError("Unknown language code %s and %s." % (lang_code, generic_lang_code))
if info:
- info['name_translated'] = ugettext_lazy(info['name'])
+ info['name_translated'] = gettext_lazy(info['name'])
return info
diff --git a/django/views/csrf.py b/django/views/csrf.py
index 5e13e529fc..6119f3b49d 100644
--- a/django/views/csrf.py
+++ b/django/views/csrf.py
@@ -1,7 +1,7 @@
from django.conf import settings
from django.http import HttpResponseForbidden
from django.template import Context, Engine, TemplateDoesNotExist, loader
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from django.utils.version import get_docs_version
# We include the template inline since we need to be able to reliably display
diff --git a/django/views/debug.py b/django/views/debug.py
index c22acdc676..c7c1b20f30 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -12,7 +12,7 @@ from django.utils import timezone
from django.utils.datastructures import MultiValueDict
from django.utils.encoding import force_text
from django.utils.module_loading import import_string
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
# Minimal Django templates engine to render the error templates
# regardless of the project's TEMPLATES setting.
diff --git a/django/views/generic/dates.py b/django/views/generic/dates.py
index f0c50a42b3..48434d2adc 100644
--- a/django/views/generic/dates.py
+++ b/django/views/generic/dates.py
@@ -7,7 +7,7 @@ from django.http import Http404
from django.utils import timezone
from django.utils.encoding import force_text
from django.utils.functional import cached_property
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from django.views.generic.base import View
from django.views.generic.detail import (
BaseDetailView, SingleObjectTemplateResponseMixin,
diff --git a/django/views/generic/detail.py b/django/views/generic/detail.py
index 24b406523d..fe96005ca8 100644
--- a/django/views/generic/detail.py
+++ b/django/views/generic/detail.py
@@ -1,7 +1,7 @@
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.http import Http404
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
diff --git a/django/views/generic/list.py b/django/views/generic/list.py
index 61320fccbe..df03c586f5 100644
--- a/django/views/generic/list.py
+++ b/django/views/generic/list.py
@@ -2,7 +2,7 @@ from django.core.exceptions import ImproperlyConfigured
from django.core.paginator import InvalidPage, Paginator
from django.db.models.query import QuerySet
from django.http import Http404
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
diff --git a/django/views/static.py b/django/views/static.py
index a0f4bdab56..479c59cac6 100644
--- a/django/views/static.py
+++ b/django/views/static.py
@@ -15,7 +15,7 @@ from django.http import (
)
from django.template import Context, Engine, TemplateDoesNotExist, loader
from django.utils.http import http_date, parse_http_date
-from django.utils.translation import ugettext as _, ugettext_lazy
+from django.utils.translation import gettext as _, gettext_lazy
def serve(request, path, document_root=None, show_indexes=False):
@@ -95,7 +95,7 @@ DEFAULT_DIRECTORY_INDEX_TEMPLATE = """