More Django fixes.

This commit is contained in:
Jannis Leidel 2021-03-09 12:44:05 +01:00
parent 39c6d80b7b
commit 245b5911e6
No known key found for this signature in database
GPG key ID: C795956FB489DCA9
4 changed files with 8 additions and 8 deletions

View file

@ -2,7 +2,7 @@ from django.contrib import messages
from django.db import router
from django.utils.encoding import force_str
from django.utils.text import capfirst
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy, ngettext, pgettext_lazy
from django.views.generic import TemplateView

View file

@ -3,7 +3,7 @@ from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import force_str
from django.utils.translation import ugettext, gettext_lazy as _
from django.utils.translation import gettext, gettext_lazy as _
from .utils import quote
@ -46,18 +46,18 @@ class LogEntry(models.Model):
def __str__(self):
if self.action_flag == self.ADDITION:
return ugettext('Added "%(object)s".') % {
return gettext('Added "%(object)s".') % {
'object': self.object_repr}
elif self.action_flag == self.CHANGE:
return ugettext('Changed "%(object)s" - %(changes)s') % {
return gettext('Changed "%(object)s" - %(changes)s') % {
'object': self.object_repr,
'changes': self.change_message,
}
elif self.action_flag == self.DELETION:
return ugettext('Deleted "%(object)s."') % {
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 == self.ADDITION

View file

@ -7,7 +7,7 @@ from django.http import HttpResponseRedirect
from django.urls import reverse, reverse_lazy
from django.utils.encoding import force_str
from django.utils.text import get_text_list
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
# braces 1.3 views exported AccessMixin
# in braces 1.4 this was moved views._access and not exported in views

View file

@ -71,7 +71,7 @@ Marking strings for translation
**Python code**
Make sure to use ugettext or gettext_lazy on strings that will be shown to the users,
Make sure to use gettext or gettext_lazy on strings that will be shown to the users,
with string interpolation ( "%(name_of_variable)s" instead of "%s" ) where needed.
Remember that all languages do not use the same word order, so try to provide flexible strings to translate !