From 00cb6a1ba81711c6fc361a3fc0498685bf3953e8 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Mon, 23 Apr 2007 05:51:29 +0000 Subject: [PATCH] Fixed #4107 -- Marked a few more strings for translation. Thanks, Baptiste. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5061 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/auth/models.py | 2 +- django/template/defaultfilters.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) 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'): """