From 459307c9bdfe668ff26fa00baa75ac7fa76a99dd Mon Sep 17 00:00:00 2001 From: Raffaele Salmaso Date: Sun, 18 Feb 2018 10:31:35 +0100 Subject: [PATCH] Use regular gettext functions instead of unicode version. --- src/wiki/admin.py | 2 +- src/wiki/apps.py | 2 +- src/wiki/conf/settings.py | 2 +- src/wiki/core/plugins/base.py | 2 +- src/wiki/forms.py | 30 ++++++++++----------- src/wiki/models/article.py | 2 +- src/wiki/models/pluginbase.py | 2 +- src/wiki/models/urlpath.py | 6 ++--- src/wiki/plugins/attachments/apps.py | 2 +- src/wiki/plugins/attachments/forms.py | 10 +++---- src/wiki/plugins/attachments/models.py | 8 +++--- src/wiki/plugins/attachments/views.py | 2 +- src/wiki/plugins/attachments/wiki_plugin.py | 2 +- src/wiki/plugins/globalhistory/apps.py | 2 +- src/wiki/plugins/help/apps.py | 2 +- src/wiki/plugins/help/wiki_plugin.py | 2 +- src/wiki/plugins/images/apps.py | 2 +- src/wiki/plugins/images/forms.py | 8 +++--- src/wiki/plugins/images/models.py | 10 +++---- src/wiki/plugins/images/views.py | 2 +- src/wiki/plugins/images/wiki_plugin.py | 2 +- src/wiki/plugins/links/apps.py | 2 +- src/wiki/plugins/links/wiki_plugin.py | 2 +- src/wiki/plugins/macros/apps.py | 2 +- src/wiki/plugins/macros/mdx/macro.py | 2 +- src/wiki/plugins/macros/wiki_plugin.py | 2 +- src/wiki/plugins/notifications/apps.py | 2 +- src/wiki/plugins/notifications/forms.py | 18 ++++++------- src/wiki/plugins/notifications/models.py | 2 +- src/wiki/plugins/notifications/util.py | 2 +- src/wiki/plugins/notifications/views.py | 2 +- src/wiki/views/accounts.py | 2 +- src/wiki/views/article.py | 6 ++--- 33 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/wiki/admin.py b/src/wiki/admin.py index 145e6adc..9a3ef22d 100644 --- a/src/wiki/admin.py +++ b/src/wiki/admin.py @@ -1,7 +1,7 @@ from django import forms from django.contrib import admin from django.contrib.contenttypes.admin import GenericTabularInline -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from mptt.admin import MPTTModelAdmin from . import editors, models diff --git a/src/wiki/apps.py b/src/wiki/apps.py index 7f449548..8f2b17cf 100644 --- a/src/wiki/apps.py +++ b/src/wiki/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 WikiConfig(AppConfig): diff --git a/src/wiki/conf/settings.py b/src/wiki/conf/settings.py index 60bc1326..0f35e234 100644 --- a/src/wiki/conf/settings.py +++ b/src/wiki/conf/settings.py @@ -5,7 +5,7 @@ from django.conf import settings as django_settings from django.contrib.messages import constants as messages from django.core.files.storage import default_storage from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ #: Should urls be case sensitive? URL_CASE_SENSITIVE = getattr(django_settings, 'WIKI_URL_CASE_SENSITIVE', False) diff --git a/src/wiki/core/plugins/base.py b/src/wiki/core/plugins/base.py index 72c553b7..930910f4 100644 --- a/src/wiki/core/plugins/base.py +++ b/src/wiki/core/plugins/base.py @@ -1,5 +1,5 @@ from django import forms -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ """Base classes for different plugin objects. diff --git a/src/wiki/forms.py b/src/wiki/forms.py index c597bf54..bccf7afc 100644 --- a/src/wiki/forms.py +++ b/src/wiki/forms.py @@ -18,8 +18,8 @@ from django.utils.encoding import force_text from django.utils.html import conditional_escape, escape from django.utils.safestring import mark_safe from django.utils.translation import pgettext_lazy -from django.utils.translation import ugettext -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext +from django.utils.translation import gettext_lazy as _ from wiki import models from wiki.conf import settings @@ -58,10 +58,10 @@ class WikiSlugField(forms.SlugField): def _clean_slug(slug, urlpath): if slug.startswith("_"): raise forms.ValidationError( - ugettext('A slug may not begin with an underscore.')) + gettext('A slug may not begin with an underscore.')) if slug == 'admin': raise forms.ValidationError( - ugettext("'admin' is not a permitted slug name.")) + gettext("'admin' is not a permitted slug name.")) if settings.URL_CASE_SENSITIVE: already_existing_slug = models.URLPath.objects.filter( @@ -76,11 +76,11 @@ def _clean_slug(slug, urlpath): already_urlpath = already_existing_slug[0] if already_urlpath.article and already_urlpath.article.current_revision.deleted: raise forms.ValidationError( - ugettext('A deleted article with slug "%s" already exists.') % + gettext('A deleted article with slug "%s" already exists.') % already_urlpath.slug) else: raise forms.ValidationError( - ugettext('A slug named "%s" already exists.') % + gettext('A slug named "%s" already exists.') % already_urlpath.slug) if settings.CHECK_SLUG_URL_AVAILABLE: @@ -89,7 +89,7 @@ def _clean_slug(slug, urlpath): match = resolve(urlpath.path + '/' + slug + '/') if match.app_name != 'wiki': raise forms.ValidationError( - ugettext('This slug conflicts with an existing URL.')) + gettext('This slug conflicts with an existing URL.')) except Resolver404: pass @@ -123,7 +123,7 @@ class SpamProtectionMixin(object): if not (user or ip_address): raise forms.ValidationError( - ugettext( + gettext( 'Spam protection failed to find both a logged in user and an IP address.')) def check_interval(from_time, max_count, interval_name): @@ -139,7 +139,7 @@ class SpamProtectionMixin(object): revisions = revisions.count() if revisions >= max_count: raise forms.ValidationError( - ugettext('Spam protection: You are only allowed to create or edit %(revisions)d article(s) per %(interval_name)s.') % { + gettext('Spam protection: You are only allowed to create or edit %(revisions)d article(s) per %(interval_name)s.') % { 'revisions': max_count, 'interval_name': interval_name, }) @@ -266,7 +266,7 @@ class EditForm(forms.Form, SpamProtectionMixin): title = self.cleaned_data.get('title', None) title = (title or "").strip() if not title: - raise forms.ValidationError(ugettext('Article is missing title or has an invalid title')) + raise forms.ValidationError(gettext('Article is missing title or has an invalid title')) return title def clean(self): @@ -279,11 +279,11 @@ class EditForm(forms.Form, SpamProtectionMixin): return cd if not str(self.initial_revision.id) == str(self.presumed_revision): raise forms.ValidationError( - ugettext( + gettext( 'While you were editing, someone else changed the revision. Your contents have been automatically merged with the new contents. Please review the text below.')) if ('title' in cd) and cd['title'] == self.initial_revision.title and cd[ 'content'] == self.initial_revision.content: - raise forms.ValidationError(ugettext('No changes made. Nothing to save.')) + raise forms.ValidationError(gettext('No changes made. Nothing to save.')) self.check_spam() return cd @@ -421,10 +421,10 @@ class DeleteForm(forms.Form): def clean(self): cd = super().clean() if not cd['confirm']: - raise forms.ValidationError(ugettext('You are not sure enough!')) + raise forms.ValidationError(gettext('You are not sure enough!')) if cd['revision'] != self.article.current_revision: raise forms.ValidationError( - ugettext( + gettext( 'While you tried to delete this article, it was modified. TAKE CARE!')) return cd @@ -531,7 +531,7 @@ class PermissionsForm(PluginSettingsFormMixin, forms.ModelForm): user = User.objects.get(**kwargs) except User.DoesNotExist: raise forms.ValidationError( - ugettext('No user with that username')) + gettext('No user with that username')) else: user = None else: diff --git a/src/wiki/models/article.py b/src/wiki/models/article.py index 0ec1f715..6b9e0a96 100644 --- a/src/wiki/models/article.py +++ b/src/wiki/models/article.py @@ -7,7 +7,7 @@ from django.db.models.fields import GenericIPAddressField as IPAddressField from django.db.models.signals import post_save, pre_delete, pre_save from django.utils import translation from django.utils.safestring import mark_safe -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from mptt.models import MPTTModel from wiki import managers from wiki.conf import settings diff --git a/src/wiki/models/pluginbase.py b/src/wiki/models/pluginbase.py index 2ea5c4a6..30acecef 100644 --- a/src/wiki/models/pluginbase.py +++ b/src/wiki/models/pluginbase.py @@ -20,7 +20,7 @@ There are three kinds of plugin base models: """ from django.db import models from django.db.models import signals -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from wiki.decorators import disable_signal_for_loaddata from .article import ArticleRevision, BaseRevisionMixin diff --git a/src/wiki/models/urlpath.py b/src/wiki/models/urlpath.py index ac3650c8..fa4c797b 100644 --- a/src/wiki/models/urlpath.py +++ b/src/wiki/models/urlpath.py @@ -9,8 +9,8 @@ from django.core.urlresolvers import reverse from django.db import models, transaction from django.db.models.signals import post_save, pre_delete # Django 1.6 transaction API, required for 1.8+ -from django.utils.translation import ugettext_lazy as _ -from django.utils.translation import ugettext +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import gettext from mptt.fields import TreeForeignKey from mptt.models import MPTTModel from wiki import managers @@ -174,7 +174,7 @@ class URLPath(MPTTModel): def __str__(self): path = self.path - return path if path else ugettext("(root)") + return path if path else gettext("(root)") def delete(self, *args, **kwargs): assert not (self.parent and self.get_children() diff --git a/src/wiki/plugins/attachments/apps.py b/src/wiki/plugins/attachments/apps.py index 128bf3db..7a9a347e 100644 --- a/src/wiki/plugins/attachments/apps.py +++ b/src/wiki/plugins/attachments/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 AttachmentsConfig(AppConfig): diff --git a/src/wiki/plugins/attachments/forms.py b/src/wiki/plugins/attachments/forms.py index 7b97cd69..5be23f3e 100644 --- a/src/wiki/plugins/attachments/forms.py +++ b/src/wiki/plugins/attachments/forms.py @@ -3,8 +3,8 @@ import zipfile from django import forms from django.core.files.uploadedfile import File -from django.utils.translation import ugettext_lazy as _ -from django.utils.translation import ugettext +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import gettext from wiki.core.permissions import can_moderate from wiki.plugins.attachments import models from wiki.plugins.attachments.models import IllegalFileExtension @@ -101,7 +101,7 @@ class AttachmentArchiveForm(AttachmentForm): except IllegalFileExtension as e: raise forms.ValidationError(e) except zipfile.BadZipfile: - raise forms.ValidationError(ugettext("Not a zip file")) + raise forms.ValidationError(gettext("Not a zip file")) else: return super().clean_file() return uploaded_file @@ -110,7 +110,7 @@ class AttachmentArchiveForm(AttachmentForm): super().clean() if not can_moderate(self.article, self.request.user): raise forms.ValidationError( - ugettext("User not allowed to moderate this article")) + gettext("User not allowed to moderate this article")) return self.cleaned_data def save(self, *args, **kwargs): @@ -161,7 +161,7 @@ class DeleteForm(forms.Form): def clean_confirm(self): if not self.cleaned_data['confirm']: - raise forms.ValidationError(ugettext('You are not sure enough!')) + raise forms.ValidationError(gettext('You are not sure enough!')) return True diff --git a/src/wiki/plugins/attachments/models.py b/src/wiki/plugins/attachments/models.py index 1bd7d8a5..62188dae 100644 --- a/src/wiki/plugins/attachments/models.py +++ b/src/wiki/plugins/attachments/models.py @@ -3,8 +3,8 @@ import os from django.conf import settings as django_settings from django.db import models from django.db.models import signals -from django.utils.translation import ugettext_lazy as _ -from django.utils.translation import ugettext +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import gettext from wiki import managers from wiki.decorators import disable_signal_for_loaddata from wiki.models.article import BaseRevisionMixin @@ -65,12 +65,12 @@ def extension_allowed(filename): except IndexError: # No extension raise IllegalFileExtension( - ugettext("No file extension found in filename. That's not okay!")) + gettext("No file extension found in filename. That's not okay!")) if not extension.lower() in map( lambda x: x.lower(), settings.FILE_EXTENSIONS): raise IllegalFileExtension( - ugettext( + gettext( "The following filename is illegal: {filename:s}. Extension " "has to be one of {extensions:s}" ).format( diff --git a/src/wiki/plugins/attachments/views.py b/src/wiki/plugins/attachments/views.py index 6aa2407d..f339922a 100644 --- a/src/wiki/plugins/attachments/views.py +++ b/src/wiki/plugins/attachments/views.py @@ -4,7 +4,7 @@ from django.db.models import Q from django.http import Http404, HttpResponseRedirect from django.shortcuts import get_object_or_404, redirect from django.utils.decorators import method_decorator -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.views.generic.base import TemplateView, View from django.views.generic.edit import FormView from django.views.generic.list import ListView diff --git a/src/wiki/plugins/attachments/wiki_plugin.py b/src/wiki/plugins/attachments/wiki_plugin.py index 0120150b..09fd5399 100644 --- a/src/wiki/plugins/attachments/wiki_plugin.py +++ b/src/wiki/plugins/attachments/wiki_plugin.py @@ -1,5 +1,5 @@ from django.conf.urls import include, url -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from wiki.core.plugins import registry from wiki.core.plugins.base import BasePlugin from wiki.plugins.attachments import models, settings, views diff --git a/src/wiki/plugins/globalhistory/apps.py b/src/wiki/plugins/globalhistory/apps.py index 61cc2d8a..6747fa42 100644 --- a/src/wiki/plugins/globalhistory/apps.py +++ b/src/wiki/plugins/globalhistory/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 GlobalHistoryConfig(AppConfig): diff --git a/src/wiki/plugins/help/apps.py b/src/wiki/plugins/help/apps.py index 8877821a..5cbf12e4 100644 --- a/src/wiki/plugins/help/apps.py +++ b/src/wiki/plugins/help/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 HelpConfig(AppConfig): diff --git a/src/wiki/plugins/help/wiki_plugin.py b/src/wiki/plugins/help/wiki_plugin.py index c619bb38..ad823946 100644 --- a/src/wiki/plugins/help/wiki_plugin.py +++ b/src/wiki/plugins/help/wiki_plugin.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from wiki.core.plugins import registry from wiki.core.plugins.base import BasePlugin diff --git a/src/wiki/plugins/images/apps.py b/src/wiki/plugins/images/apps.py index 5dedc28d..cf4b4af6 100644 --- a/src/wiki/plugins/images/apps.py +++ b/src/wiki/plugins/images/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 ImagesConfig(AppConfig): diff --git a/src/wiki/plugins/images/forms.py b/src/wiki/plugins/images/forms.py index 3870c6b3..6311cf84 100644 --- a/src/wiki/plugins/images/forms.py +++ b/src/wiki/plugins/images/forms.py @@ -1,6 +1,6 @@ from django import forms -from django.utils.translation import ugettext_lazy as _ -from django.utils.translation import ugettext +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import gettext from wiki.core.plugins.base import PluginSidebarFormMixin from wiki.plugins.images import models @@ -14,7 +14,7 @@ class SidebarForm(PluginSidebarFormMixin): self.fields['image'].required = True def get_usermessage(self): - return ugettext( + return gettext( "New image %s was successfully uploaded. You can use it by selecting it from the list of available images.") % self.instance.get_filename() def save(self, *args, **kwargs): @@ -64,5 +64,5 @@ class PurgeForm(forms.Form): def clean_confirm(self): confirm = self.cleaned_data['confirm'] if not confirm: - raise forms.ValidationError(ugettext('You are not sure enough!')) + raise forms.ValidationError(gettext('You are not sure enough!')) return confirm diff --git a/src/wiki/plugins/images/models.py b/src/wiki/plugins/images/models.py index bdc76d80..be38cdc8 100644 --- a/src/wiki/plugins/images/models.py +++ b/src/wiki/plugins/images/models.py @@ -5,8 +5,8 @@ from django.conf import settings as django_settings from django.core.exceptions import ImproperlyConfigured from django.db import models from django.db.models import signals -from django.utils.translation import ugettext_lazy as _ -from django.utils.translation import ugettext +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import gettext from wiki.models.pluginbase import RevisionPlugin, RevisionPluginRevision from . import settings @@ -48,9 +48,9 @@ class Image(RevisionPlugin): def __str__(self): if self.current_revision: - return ugettext('Image: %s') % self.current_revision.imagerevision.get_filename() + return gettext('Image: %s') % self.current_revision.imagerevision.get_filename() else: - return ugettext('Current revision not set!!') + return gettext('Current revision not set!!') class ImageRevision(RevisionPluginRevision): @@ -108,7 +108,7 @@ class ImageRevision(RevisionPluginRevision): ordering = ('-created',) def __str__(self): - return ugettext('Image Revision: %d') % self.revision_number + return gettext('Image Revision: %d') % self.revision_number def on_image_revision_delete(instance, *args, **kwargs): diff --git a/src/wiki/plugins/images/views.py b/src/wiki/plugins/images/views.py index 41d96566..8fe3ac6d 100644 --- a/src/wiki/plugins/images/views.py +++ b/src/wiki/plugins/images/views.py @@ -4,7 +4,7 @@ from django.contrib import messages from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404, redirect from django.utils.decorators import method_decorator -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.views.generic.base import RedirectView from django.views.generic.edit import FormView from django.views.generic.list import ListView diff --git a/src/wiki/plugins/images/wiki_plugin.py b/src/wiki/plugins/images/wiki_plugin.py index eda4236e..579d725f 100644 --- a/src/wiki/plugins/images/wiki_plugin.py +++ b/src/wiki/plugins/images/wiki_plugin.py @@ -1,5 +1,5 @@ from django.conf.urls import url -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from wiki.core.plugins import registry from wiki.core.plugins.base import BasePlugin from wiki.plugins.images import forms, models, settings, views diff --git a/src/wiki/plugins/links/apps.py b/src/wiki/plugins/links/apps.py index 3a9fa7b2..8b776ecf 100644 --- a/src/wiki/plugins/links/apps.py +++ b/src/wiki/plugins/links/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 LinksConfig(AppConfig): diff --git a/src/wiki/plugins/links/wiki_plugin.py b/src/wiki/plugins/links/wiki_plugin.py index 8072d98c..00af4e3a 100644 --- a/src/wiki/plugins/links/wiki_plugin.py +++ b/src/wiki/plugins/links/wiki_plugin.py @@ -1,6 +1,6 @@ from django.conf.urls import url from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from wiki.core.plugins import registry from wiki.core.plugins.base import BasePlugin from wiki.plugins.links import settings, views diff --git a/src/wiki/plugins/macros/apps.py b/src/wiki/plugins/macros/apps.py index 5669654d..b909213a 100644 --- a/src/wiki/plugins/macros/apps.py +++ b/src/wiki/plugins/macros/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 MacrosConfig(AppConfig): diff --git a/src/wiki/plugins/macros/mdx/macro.py b/src/wiki/plugins/macros/mdx/macro.py index 184b57d2..85e36acf 100644 --- a/src/wiki/plugins/macros/mdx/macro.py +++ b/src/wiki/plugins/macros/mdx/macro.py @@ -2,7 +2,7 @@ import re import markdown from django.template.loader import render_to_string -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.utils.six import string_types from wiki.plugins.macros import settings diff --git a/src/wiki/plugins/macros/wiki_plugin.py b/src/wiki/plugins/macros/wiki_plugin.py index cca4e71c..f34c468c 100644 --- a/src/wiki/plugins/macros/wiki_plugin.py +++ b/src/wiki/plugins/macros/wiki_plugin.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from wiki.core.plugins import registry from wiki.core.plugins.base import BasePlugin from wiki.plugins.macros import settings diff --git a/src/wiki/plugins/notifications/apps.py b/src/wiki/plugins/notifications/apps.py index b582bd3d..51c92c68 100644 --- a/src/wiki/plugins/notifications/apps.py +++ b/src/wiki/plugins/notifications/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 NotificationsConfig(AppConfig): diff --git a/src/wiki/plugins/notifications/forms.py b/src/wiki/plugins/notifications/forms.py index 5f82a972..0ac3c921 100644 --- a/src/wiki/plugins/notifications/forms.py +++ b/src/wiki/plugins/notifications/forms.py @@ -2,8 +2,8 @@ from django import forms from django.contrib.contenttypes.models import ContentType from django.forms.models import BaseModelFormSet, modelformset_factory from django.utils.safestring import mark_safe -from django.utils.translation import ugettext_lazy as _ -from django.utils.translation import ugettext +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import gettext from django_nyt.models import NotificationType, Settings, Subscription from wiki.core.plugins.base import PluginSettingsFormMixin from wiki.plugins.notifications import models @@ -13,7 +13,7 @@ from wiki.plugins.notifications.settings import ARTICLE_EDIT class SettingsModelChoiceField(forms.ModelChoiceField): def label_from_instance(self, obj): - return ugettext( + return gettext( "Receive notifications %(interval)s" ) % { 'interval': obj.get_interval_display() @@ -24,7 +24,7 @@ class ArticleSubscriptionModelMultipleChoiceField( forms.ModelMultipleChoiceField): def label_from_instance(self, obj): - return ugettext("%(title)s - %(url)s") % { + return gettext("%(title)s - %(url)s") % { 'title': obj.article.current_revision.title, 'url': obj.article.get_absolute_url() } @@ -41,17 +41,17 @@ class SettingsModelForm(forms.ModelForm): self.fields['delete_subscriptions'] = ArticleSubscriptionModelMultipleChoiceField( models.ArticleSubscription.objects.filter( subscription__settings=instance), - label=ugettext("Remove subscriptions"), + label=gettext("Remove subscriptions"), required=False, - help_text=ugettext("Select article subscriptions to remove from notifications"), + help_text=gettext("Select article subscriptions to remove from notifications"), initial=models.ArticleSubscription.objects.none(), ) self.fields['email'] = forms.TypedChoiceField( label=_("Email digests"), choices=( - (0, ugettext('Unchanged (selected on each article)')), - (1, ugettext('No emails')), - (2, ugettext('Email on any change')), + (0, gettext('Unchanged (selected on each article)')), + (1, gettext('No emails')), + (2, gettext('Email on any change')), ), coerce=lambda x: int(x) if x is not None else None, widget=forms.RadioSelect(), diff --git a/src/wiki/plugins/notifications/models.py b/src/wiki/plugins/notifications/models.py index 288c98fd..b1f663f3 100644 --- a/src/wiki/plugins/notifications/models.py +++ b/src/wiki/plugins/notifications/models.py @@ -1,7 +1,7 @@ from django.core.urlresolvers import reverse from django.db import models from django.db.models import signals -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django_nyt.models import Subscription from django_nyt.utils import notify from wiki import models as wiki_models diff --git a/src/wiki/plugins/notifications/util.py b/src/wiki/plugins/notifications/util.py index 7051bc15..be928d65 100644 --- a/src/wiki/plugins/notifications/util.py +++ b/src/wiki/plugins/notifications/util.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ def get_title(article): diff --git a/src/wiki/plugins/notifications/views.py b/src/wiki/plugins/notifications/views.py index 05dc9b1b..4c3aaa2f 100644 --- a/src/wiki/plugins/notifications/views.py +++ b/src/wiki/plugins/notifications/views.py @@ -2,7 +2,7 @@ from django.contrib import messages from django.contrib.auth.decorators import login_required from django.shortcuts import redirect from django.utils.decorators import method_decorator -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.views.generic.edit import FormView from . import forms, models diff --git a/src/wiki/views/accounts.py b/src/wiki/views/accounts.py index b20706cc..f72c64d8 100644 --- a/src/wiki/views/accounts.py +++ b/src/wiki/views/accounts.py @@ -16,7 +16,7 @@ from django.contrib.auth import logout as auth_logout from django.contrib.auth.forms import AuthenticationForm from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404, redirect, render -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.edit import CreateView, FormView, UpdateView from wiki import forms diff --git a/src/wiki/views/article.py b/src/wiki/views/article.py index dd37de6c..a0b66159 100644 --- a/src/wiki/views/article.py +++ b/src/wiki/views/article.py @@ -9,8 +9,8 @@ from django.db.models import Q from django.http import Http404 from django.shortcuts import get_object_or_404, redirect, render from django.utils.decorators import method_decorator -from django.utils.translation import ugettext as _ -from django.utils.translation import ungettext +from django.utils.translation import gettext as _ +from django.utils.translation import ngettext from django.views.generic.base import RedirectView, TemplateView, View from django.views.generic.edit import FormView from django.views.generic.list import ListView @@ -488,7 +488,7 @@ class Move(ArticleMixin, FormView): messages.success( self.request, - ungettext( + ngettext( "Article successfully moved! Created {n} redirect.", "Article successfully moved! Created {n} redirects.", len(descendants) -- 2.45.2