diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py index f686d90e7a..6fe781a041 100644 --- a/django/contrib/auth/models.py +++ b/django/contrib/auth/models.py @@ -273,7 +273,7 @@ class AnonymousUser(object): pass def __str__(self): - return 'AnonymousUser' + return _('AnonymousUser') def __eq__(self, other): return isinstance(other, self.__class__) diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py index a025365c90..bbaceba24a 100644 --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -2,7 +2,7 @@ from django.template import resolve_variable, Library from django.conf import settings -from django.utils.translation import gettext +from django.utils.translation import gettext, ngettext import re import random as random_module @@ -517,12 +517,12 @@ def filesizeformat(bytes): return "0 bytes" if bytes < 1024: - return "%d byte%s" % (bytes, bytes != 1 and 's' or '') + return ngettext("%(size)d byte", "%(size)d bytes", bytes) % {'size': bytes} if bytes < 1024 * 1024: - return "%.1f KB" % (bytes / 1024) + return gettext("%.1f KB") % (bytes / 1024) if bytes < 1024 * 1024 * 1024: - return "%.1f MB" % (bytes / (1024 * 1024)) - return "%.1f GB" % (bytes / (1024 * 1024 * 1024)) + return gettext("%.1f MB") % (bytes / (1024 * 1024)) + return gettext("%.1f GB") % (bytes / (1024 * 1024 * 1024)) def pluralize(value, arg='s'): """