Ticket #2506: admin-views-doc-i18n.diff

File admin-views-doc-i18n.diff, 5.6 KB (added by dummy@…, 18 years ago)

more i18n ...

  • django/contrib/admin/views/doc.py

     
    4343        for tag_name, tag_func in library.tags.items():
    4444            title, body, metadata = utils.parse_docstring(tag_func.__doc__)
    4545            if title:
    46                 title = utils.parse_rst(title, 'tag', 'tag:' + tag_name)
     46                title = utils.parse_rst(title, 'tag', _('tag:') + tag_name)
    4747            if body:
    48                 body = utils.parse_rst(body, 'tag', 'tag:' + tag_name)
     48                body = utils.parse_rst(body, 'tag', _('tag:') + tag_name)
    4949            for key in metadata:
    50                 metadata[key] = utils.parse_rst(metadata[key], 'tag', 'tag:' + tag_name)
     50                metadata[key] = utils.parse_rst(metadata[key], 'tag', _('tag:') + tag_name)
    5151            if library in template.builtins:
    5252                tag_library = None
    5353            else:
     
    7474        for filter_name, filter_func in library.filters.items():
    7575            title, body, metadata = utils.parse_docstring(filter_func.__doc__)
    7676            if title:
    77                 title = utils.parse_rst(title, 'filter', 'filter:' + filter_name)
     77                title = utils.parse_rst(title, 'filter', _('filter:') + filter_name)
    7878            if body:
    79                 body = utils.parse_rst(body, 'filter', 'filter:' + filter_name)
     79                body = utils.parse_rst(body, 'filter', _('filter:') + filter_name)
    8080            for key in metadata:
    81                 metadata[key] = utils.parse_rst(metadata[key], 'filter', 'filter:' + filter_name)
     81                metadata[key] = utils.parse_rst(metadata[key], 'filter', _('filter:') + filter_name)
    8282            if library in template.builtins:
    8383                tag_library = None
    8484            else:
     
    132132        raise Http404
    133133    title, body, metadata = utils.parse_docstring(view_func.__doc__)
    134134    if title:
    135         title = utils.parse_rst(title, 'view', 'view:' + view)
     135        title = utils.parse_rst(title, 'view', _('view:') + view)
    136136    if body:
    137         body = utils.parse_rst(body, 'view', 'view:' + view)
     137        body = utils.parse_rst(body, 'view', _('view:') + view)
    138138    for key in metadata:
    139         metadata[key] = utils.parse_rst(metadata[key], 'model', 'view:' + view)
     139        metadata[key] = utils.parse_rst(metadata[key], 'model', _('view:') + view)
    140140    return render_to_response('admin_doc/view_detail.html', {
    141141        'name': view,
    142142        'summary': title,
     
    161161    try:
    162162        app_mod = models.get_app(app_label)
    163163    except ImproperlyConfigured:
    164         raise Http404, "App %r not found" % app_label
     164        raise Http404, _("App %r not found") % app_label
    165165    model = None
    166166    for m in models.get_models(app_mod):
    167167        if m._meta.object_name.lower() == model_name:
    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 %r not found in app %r") % (model_name, 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 `%s.%s` object")  % (app_label, data_type)), 'model', _('model:') + data_type)
    184184        else:
    185185            data_type = get_readable_field_data_type(field)
    186186            verbose = field.verbose_name
     
    202202                continue
    203203            verbose = func.__doc__
    204204            if verbose:
    205                 verbose = utils.parse_rst(utils.trim_docstring(verbose), 'model', 'model:' + opts.module_name)
     205                verbose = utils.parse_rst(utils.trim_docstring(verbose), 'model', _('model:') + opts.module_name)
    206206            fields.append({
    207207                'name': func_name,
    208208                'data_type': get_return_data_type(func_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 `%s.%s` objects") % (rel.opts.app_label, rel.opts.object_name)
    215215        accessor = rel.get_accessor_name()
    216216        fields.append({
    217217            'name'      : "%s.all" % accessor,
    218218            'data_type' : 'List',
    219             'verbose'   : utils.parse_rst("all " + verbose , 'model', 'model:' + opts.module_name),
     219            'verbose'   : utils.parse_rst(_("all %s") % verbose , 'model', _('model:') + opts.module_name),
    220220        })
    221221        fields.append({
    222222            'name'      : "%s.count" % accessor,
    223223            'data_type' : 'Integer',
    224             'verbose'   : utils.parse_rst("number of " + verbose , 'model', 'model:' + opts.module_name),
     224            'verbose'   : utils.parse_rst(_("number of %s") % verbose , 'model', _('model:') + opts.module_name),
    225225        })
    226226
    227227    return render_to_response('admin_doc/model_detail.html', {
     
    336336        elif hasattr(p, '_get_url_patterns'):
    337337            views.extend(extract_views_from_urlpatterns(p.url_patterns, base + p.regex.pattern))
    338338        else:
    339             raise TypeError, "%s does not appear to be a urlpattern object" % p
     339            raise TypeError, _("%s does not appear to be a urlpattern object") % p
    340340    return views
    341341
    342342named_group_matcher = re.compile(r'\(\?P(<\w+>).+?\)')
Back to Top