diff --git a/aplus/settings.py b/aplus/settings.py index 763c22bbe..8b1ab69c7 100644 --- a/aplus/settings.py +++ b/aplus/settings.py @@ -4,7 +4,7 @@ # You can copy local_settings.example.py and start from there. ## from os.path import abspath, dirname, join -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ BASE_DIR = dirname(dirname(abspath(__file__))) diff --git a/apps/models.py b/apps/models.py index 05793ccf9..822f691e8 100644 --- a/apps/models.py +++ b/apps/models.py @@ -14,7 +14,7 @@ from django.db import models from django.template import loader from django.utils.safestring import mark_safe -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import feedparser from apps.app_renderers import ExternalIFramePluginRenderer, \ diff --git a/authorization/permissions.py b/authorization/permissions.py index 8241126e6..653f492d9 100644 --- a/authorization/permissions.py +++ b/authorization/permissions.py @@ -1,5 +1,5 @@ from django.utils.text import format_lazy -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from lib.helpers import Enum diff --git a/course/admin.py b/course/admin.py index a07add118..f7d84c03e 100644 --- a/course/admin.py +++ b/course/admin.py @@ -1,5 +1,5 @@ from django.contrib import admin -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from course.models import ( Course, diff --git a/course/forms.py b/course/forms.py index f8aef301a..7dc0f79e7 100644 --- a/course/forms.py +++ b/course/forms.py @@ -1,7 +1,7 @@ from django import forms from django.contrib.humanize.templatetags.humanize import ordinal from django.utils.safestring import mark_safe -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from aplus.api import api_reverse from lib.fields import UsersSearchSelectField diff --git a/course/models.py b/course/models.py index 165b452c4..ea218d51f 100644 --- a/course/models.py +++ b/course/models.py @@ -17,7 +17,7 @@ from django.utils import timezone from django.utils.functional import cached_property from django.utils.text import format_lazy -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django_colortag.models import ColorTag from apps.models import BaseTab, BasePlugin diff --git a/course/permissions.py b/course/permissions.py index 158d7dc2b..bd01fb561 100644 --- a/course/permissions.py +++ b/course/permissions.py @@ -1,5 +1,5 @@ from django.http import Http404 -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from authorization.permissions import ( ACCESS, diff --git a/course/staff_views.py b/course/staff_views.py index e700852b2..09c2c7451 100644 --- a/course/staff_views.py +++ b/course/staff_views.py @@ -2,7 +2,7 @@ from django.contrib import messages from django.shortcuts import get_object_or_404 from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from authorization.permissions import ACCESS from lib.helpers import settings_text diff --git a/course/viewbase.py b/course/viewbase.py index dde2653c1..d711accda 100644 --- a/course/viewbase.py +++ b/course/viewbase.py @@ -3,7 +3,7 @@ from django.http import Http404 from django.shortcuts import get_object_or_404, render_to_response from django.utils import translation -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.utils.translation import get_language, get_language_info from authorization.permissions import ACCESS diff --git a/course/views.py b/course/views.py index e161d08f7..231862d57 100644 --- a/course/views.py +++ b/course/views.py @@ -15,7 +15,7 @@ LANGUAGE_SESSION_KEY, check_for_language, ) -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from authorization.permissions import ACCESS from exercise.cache.hierarchy import NoSuchContent diff --git a/deviations/forms.py b/deviations/forms.py index 5a152cd72..2fd9236a6 100644 --- a/deviations/forms.py +++ b/deviations/forms.py @@ -1,5 +1,5 @@ from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from exercise.models import BaseExercise from userprofile.models import UserProfile diff --git a/deviations/views.py b/deviations/views.py index a963c23bb..318da8468 100644 --- a/deviations/views.py +++ b/deviations/views.py @@ -1,7 +1,7 @@ from django.contrib import messages from django.db import IntegrityError from django.shortcuts import get_object_or_404 -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from course.viewbase import CourseInstanceBaseView, CourseInstanceMixin from lib.viewbase import BaseFormView, BaseRedirectView diff --git a/edit_course/course_forms.py b/edit_course/course_forms.py index cbf70ab84..a47cb2cd6 100644 --- a/edit_course/course_forms.py +++ b/edit_course/course_forms.py @@ -1,6 +1,6 @@ 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 _ from django_colortag.forms import ColorTagForm from aplus.api import api_reverse diff --git a/edit_course/exercise_forms.py b/edit_course/exercise_forms.py index ae88e99d8..811374b9d 100644 --- a/edit_course/exercise_forms.py +++ b/edit_course/exercise_forms.py @@ -1,7 +1,7 @@ import logging from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from course.models import CourseModule, LearningObjectCategory from exercise.models import LearningObject, CourseChapter, BaseExercise, \ diff --git a/edit_course/managers.py b/edit_course/managers.py index 39f082a6f..35ca7e066 100644 --- a/edit_course/managers.py +++ b/edit_course/managers.py @@ -1,5 +1,5 @@ from django.shortcuts import get_object_or_404 -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from exercise.models import LearningObject, CourseChapter, \ BaseExercise, LTIExercise, StaticExercise, ExerciseWithAttachment diff --git a/edit_course/operations/batch.py b/edit_course/operations/batch.py index dc6baf878..80e10af1e 100644 --- a/edit_course/operations/batch.py +++ b/edit_course/operations/batch.py @@ -1,6 +1,6 @@ import json from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from exercise.models import BaseExercise, Submission from lib.helpers import extract_form_errors diff --git a/edit_course/operations/configure.py b/edit_course/operations/configure.py index aa3e0519d..5ac0e2b77 100644 --- a/edit_course/operations/configure.py +++ b/edit_course/operations/configure.py @@ -7,7 +7,7 @@ from django.core.exceptions import ObjectDoesNotExist from django.utils import timezone from django.utils.text import format_lazy -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from course.models import Course, CourseInstance, CourseModule, LearningObjectCategory from exercise.exercisecollection_models import ExerciseCollection diff --git a/edit_course/submission_forms.py b/edit_course/submission_forms.py index a43da0798..c802cdc70 100644 --- a/edit_course/submission_forms.py +++ b/edit_course/submission_forms.py @@ -1,5 +1,5 @@ from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from exercise.forms import SubmissionCreateAndReviewForm from userprofile.models import UserProfile diff --git a/edit_course/views.py b/edit_course/views.py index 224e303b8..98997faf9 100644 --- a/edit_course/views.py +++ b/edit_course/views.py @@ -6,8 +6,8 @@ from django.db import IntegrityError from django.http.response import Http404, HttpResponse from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ -from django.utils.translation import ungettext_lazy as ungettext +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import ngettext_lazy as ngettext from django.views.generic import ListView, CreateView, UpdateView, DeleteView, \ FormView @@ -261,7 +261,7 @@ def form_valid(self, form): tag_name = tag.name messages.success( self.request, - ungettext( + ngettext( "Tagged user {user_name} with tag {tag_name}.", "Tagged users {user_name} with tag {tag_name}.", user_set.count() diff --git a/exercise/admin.py b/exercise/admin.py index e7ab8b7d2..1971db100 100644 --- a/exercise/admin.py +++ b/exercise/admin.py @@ -1,5 +1,5 @@ from django.contrib import admin -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from exercise.models import ( CourseChapter, diff --git a/exercise/api/views.py b/exercise/api/views.py index ef5b4a45b..82fb0ad08 100644 --- a/exercise/api/views.py +++ b/exercise/api/views.py @@ -2,7 +2,7 @@ from django.core.exceptions import PermissionDenied from django.http.response import HttpResponse from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from wsgiref.util import FileWrapper from rest_framework import mixins, permissions, viewsets from rest_framework import status diff --git a/exercise/async_views.py b/exercise/async_views.py index 8a197bb8d..8e04ead8c 100644 --- a/exercise/async_views.py +++ b/exercise/async_views.py @@ -1,5 +1,5 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from lib.email_messages import email_course_error from lib.helpers import extract_form_errors diff --git a/exercise/exercise_models.py b/exercise/exercise_models.py index a212dbace..cf58f99f3 100644 --- a/exercise/exercise_models.py +++ b/exercise/exercise_models.py @@ -12,7 +12,7 @@ from django.template import loader from django.utils import timezone from django.utils.formats import date_format -from django.utils.translation import get_language, ugettext_lazy as _ +from django.utils.translation import get_language, gettext_lazy as _ from aplus.api import api_reverse from course.models import StudentGroup, CourseInstance, CourseModule, LearningObjectCategory diff --git a/exercise/exercisecollection_models.py b/exercise/exercisecollection_models.py index c882061a7..986c4dd69 100644 --- a/exercise/exercisecollection_models.py +++ b/exercise/exercisecollection_models.py @@ -3,7 +3,7 @@ from django.dispatch import receiver from django.db.models.signals import post_save from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.core.exceptions import ValidationError diff --git a/exercise/forms.py b/exercise/forms.py index ef9ef4e2d..a2bd9069d 100644 --- a/exercise/forms.py +++ b/exercise/forms.py @@ -1,6 +1,6 @@ from django import forms from django.contrib.auth.models import User -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from aplus.api import api_reverse from exercise.models import Submission diff --git a/exercise/permissions.py b/exercise/permissions.py index fa3bcf1f3..dc8ce3f29 100644 --- a/exercise/permissions.py +++ b/exercise/permissions.py @@ -1,5 +1,5 @@ from django.http import Http404 -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from authorization.permissions import ( ACCESS, diff --git a/exercise/protocol/aplus.py b/exercise/protocol/aplus.py index b4c5b8ef4..a31596443 100644 --- a/exercise/protocol/aplus.py +++ b/exercise/protocol/aplus.py @@ -1,6 +1,6 @@ import logging from django.contrib import messages -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from lib.email_messages import email_course_error from lib.remote_page import RemotePage, RemotePageException diff --git a/exercise/staff_views.py b/exercise/staff_views.py index ee39c1d29..c3e047594 100644 --- a/exercise/staff_views.py +++ b/exercise/staff_views.py @@ -9,7 +9,7 @@ from django.http.response import JsonResponse, Http404 from django.shortcuts import get_object_or_404 from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from course.viewbase import CourseInstanceBaseView, CourseInstanceMixin from course.models import ( diff --git a/exercise/submission_models.py b/exercise/submission_models.py index d33dc432c..ff1289823 100644 --- a/exercise/submission_models.py +++ b/exercise/submission_models.py @@ -8,7 +8,7 @@ from django.db import models, DatabaseError from django.db.models.signals import post_delete from django.utils import timezone -from django.utils.translation import get_language, ugettext_lazy as _ +from django.utils.translation import get_language, gettext_lazy as _ from mimetypes import guess_type from lib.fields import JSONField, PercentField diff --git a/exercise/templatetags/exercise.py b/exercise/templatetags/exercise.py index df2c024a7..aaa4b656d 100644 --- a/exercise/templatetags/exercise.py +++ b/exercise/templatetags/exercise.py @@ -3,7 +3,7 @@ from django.db.models import Max, Min 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 course.models import CourseModule from lib.errors import TagUsageError diff --git a/exercise/viewbase.py b/exercise/viewbase.py index dbe4e0d83..2c5c1a767 100644 --- a/exercise/viewbase.py +++ b/exercise/viewbase.py @@ -3,7 +3,7 @@ from django.http import Http404 from django.shortcuts import get_object_or_404 from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from authorization.permissions import ACCESS from course.viewbase import CourseModuleMixin diff --git a/exercise/views.py b/exercise/views.py index 8f68f13f8..44fcaad27 100644 --- a/exercise/views.py +++ b/exercise/views.py @@ -4,7 +4,7 @@ from django.http.response import Http404, HttpResponse, HttpResponseNotFound from django.shortcuts import get_object_or_404 from django.utils.decorators import method_decorator -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.utils.text import format_lazy from django.views.decorators.clickjacking import xframe_options_exempt from django.views.decorators.csrf import csrf_exempt diff --git a/external_services/cache.py b/external_services/cache.py index 23f0da172..cb1b4ae25 100644 --- a/external_services/cache.py +++ b/external_services/cache.py @@ -1,5 +1,5 @@ from django.db.models.signals import post_save, post_delete -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from lib.cache import CachedAbstract from .models import MenuItem diff --git a/external_services/lti.py b/external_services/lti.py index 37a20fc64..52aa48359 100644 --- a/external_services/lti.py +++ b/external_services/lti.py @@ -3,7 +3,7 @@ from django.conf import settings from django.http import Http404 -from django.utils.translation import get_language, ugettext_lazy as _ +from django.utils.translation import get_language, gettext_lazy as _ from rest_framework.reverse import reverse from rest_framework.settings import api_settings from oauthlib.common import urldecode diff --git a/external_services/permissions.py b/external_services/permissions.py index 4ba94189f..586990b49 100644 --- a/external_services/permissions.py +++ b/external_services/permissions.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from authorization.permissions import Permission, ObjectVisibleBasePermission from .models import MenuItem, LTIService diff --git a/external_services/views.py b/external_services/views.py index 35812c52e..96de4519b 100644 --- a/external_services/views.py +++ b/external_services/views.py @@ -5,7 +5,7 @@ from django.core.exceptions import PermissionDenied from django.http import Http404 from django.shortcuts import get_object_or_404 -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from urllib.parse import urlsplit, parse_qsl from authorization.permissions import ACCESS diff --git a/lib/fields.py b/lib/fields.py index 8111f5b7a..ed4aef27b 100644 --- a/lib/fields.py +++ b/lib/fields.py @@ -3,7 +3,7 @@ from django import forms from django.core import exceptions from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class PercentField(models.FloatField): diff --git a/lib/remote_page.py b/lib/remote_page.py index 613029906..9ffec9b0b 100644 --- a/lib/remote_page.py +++ b/lib/remote_page.py @@ -7,7 +7,7 @@ from django.conf import settings from django.utils.http import parse_http_date_safe from django.utils.text import format_lazy -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from urllib.parse import urlparse, urljoin diff --git a/lib/validators.py b/lib/validators.py index f429108a6..0813a5f7d 100644 --- a/lib/validators.py +++ b/lib/validators.py @@ -2,7 +2,7 @@ import re from django.core.validators import RegexValidator -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ # The URL key (slug) for a course, course instance, course module, or learning object. # The key must not consist of only the period (.) since it would be interpreted diff --git a/news/models.py b/news/models.py index ea92a8c84..4e4c30753 100644 --- a/news/models.py +++ b/news/models.py @@ -1,5 +1,5 @@ from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.utils import timezone from course.models import CourseInstance diff --git a/notification/templatetags/notification.py b/notification/templatetags/notification.py index 57178d73b..11bb9f392 100644 --- a/notification/templatetags/notification.py +++ b/notification/templatetags/notification.py @@ -1,5 +1,5 @@ from django import template -from django.utils.translation import ungettext +from django.utils.translation import ngettext from ..cache import CachedNotifications @@ -20,7 +20,7 @@ def _unread_messages(context): return { 'count': notifications.count(), 'notifications': notifications.notifications(), - "unread_message": ungettext( + "unread_message": ngettext( "new notification", "new notifications", notifications.count() diff --git a/shibboleth_login/views.py b/shibboleth_login/views.py index 89c8e383d..7694618e7 100644 --- a/shibboleth_login/views.py +++ b/shibboleth_login/views.py @@ -11,7 +11,7 @@ from django.http.response import HttpResponse from django.shortcuts import render, resolve_url from django.utils.http import is_safe_url -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from .apps import env_settings from .parser import Parser diff --git a/threshold/models.py b/threshold/models.py index 2a46d1094..c09ba01f0 100644 --- a/threshold/models.py +++ b/threshold/models.py @@ -1,5 +1,5 @@ from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from course.models import ( CourseInstance, diff --git a/userprofile/views.py b/userprofile/views.py index 00ab60c9f..d1453303b 100644 --- a/userprofile/views.py +++ b/userprofile/views.py @@ -14,7 +14,7 @@ check_for_language, get_language ) -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext from lib.helpers import settings_text, remove_query_param_from_url