Ticket #4107: diff.2.diff

File diff.2.diff, 3.0 KB (added by Baptiste <baptiste.goupil@…>, 18 years ago)

a new string to translate in contrib/auth/models.py

  • contrib/auth/models.py

     
    258258        pass
    259259
    260260    def __str__(self):
    261         return 'AnonymousUser'
     261        return _('AnonymousUser')
    262262
    263263    def __eq__(self, other):
    264264        return isinstance(other, self.__class__)
  • contrib/admindocs/views.py

     
    168168            model = m
    169169            break
    170170    if model is None:
    171         raise Http404, _("Model %r not found in app %r") % (model_name, app_label)
     171        raise Http404, _("Model %(name)r not found in app %(app)r") % {'name': model_name, 'app': app_label}
    172172
    173173    opts = model._meta
    174174
     
    180180        if isinstance(field, models.ForeignKey):
    181181            data_type = related_object_name = field.rel.to.__name__
    182182            app_label = field.rel.to._meta.app_label
    183             verbose = utils.parse_rst((_("the related `%s.%s` object")  % (app_label, data_type)), 'model', _('model:') + data_type)
     183            verbose = utils.parse_rst((_("the related `%(app)s.%(type)s` object")  % {'app': app_label, 'type': data_type}), 'model', _('model:') + data_type)
    184184        else:
    185185            data_type = get_readable_field_data_type(field)
    186186            verbose = field.verbose_name
     
    211211
    212212    # Gather related objects
    213213    for rel in opts.get_all_related_objects():
    214         verbose = _("related `%s.%s` objects") % (rel.opts.app_label, rel.opts.object_name)
     214        verbose = _("related `%(app)s.%(name)s` objects") % {'app': rel.opts.app_label, 'name': rel.opts.object_name}
    215215        accessor = rel.get_accessor_name()
    216216        fields.append({
    217217            'name'      : "%s.all" % accessor,
  • template/defaultfilters.py

     
    22
    33from django.template import resolve_variable, Library
    44from django.conf import settings
    5 from django.utils.translation import gettext
     5from django.utils.translation import gettext, ngettext
    66import re
    77import random as random_module
    88
     
    517517        return "0 bytes"
    518518       
    519519    if bytes < 1024:
    520         return "%d byte%s" % (bytes, bytes != 1 and 's' or '')
     520        return ngettext("%(size)d byte", "%(size)d bytes", bytes) % {'size': bytes}
    521521    if bytes < 1024 * 1024:
    522         return "%.1f KB" % (bytes / 1024)
     522        return gettext("%.1f KB") % (bytes / 1024)
    523523    if bytes < 1024 * 1024 * 1024:
    524         return "%.1f MB" % (bytes / (1024 * 1024))
    525     return "%.1f GB" % (bytes / (1024 * 1024 * 1024))
     524        return gettext("%.1f MB") % (bytes / (1024 * 1024))
     525    return gettext("%.1f GB") % (bytes / (1024 * 1024 * 1024))
    526526
    527527def pluralize(value, arg='s'):
    528528    """
Back to Top