Ticket #2506: admin-views-doc-i18n.diff
File admin-views-doc-i18n.diff, 5.6 KB (added by , 18 years ago) |
---|
-
django/contrib/admin/views/doc.py
43 43 for tag_name, tag_func in library.tags.items(): 44 44 title, body, metadata = utils.parse_docstring(tag_func.__doc__) 45 45 if title: 46 title = utils.parse_rst(title, 'tag', 'tag:'+ tag_name)46 title = utils.parse_rst(title, 'tag', _('tag:') + tag_name) 47 47 if body: 48 body = utils.parse_rst(body, 'tag', 'tag:'+ tag_name)48 body = utils.parse_rst(body, 'tag', _('tag:') + tag_name) 49 49 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) 51 51 if library in template.builtins: 52 52 tag_library = None 53 53 else: … … 74 74 for filter_name, filter_func in library.filters.items(): 75 75 title, body, metadata = utils.parse_docstring(filter_func.__doc__) 76 76 if title: 77 title = utils.parse_rst(title, 'filter', 'filter:'+ filter_name)77 title = utils.parse_rst(title, 'filter', _('filter:') + filter_name) 78 78 if body: 79 body = utils.parse_rst(body, 'filter', 'filter:'+ filter_name)79 body = utils.parse_rst(body, 'filter', _('filter:') + filter_name) 80 80 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) 82 82 if library in template.builtins: 83 83 tag_library = None 84 84 else: … … 132 132 raise Http404 133 133 title, body, metadata = utils.parse_docstring(view_func.__doc__) 134 134 if title: 135 title = utils.parse_rst(title, 'view', 'view:'+ view)135 title = utils.parse_rst(title, 'view', _('view:') + view) 136 136 if body: 137 body = utils.parse_rst(body, 'view', 'view:'+ view)137 body = utils.parse_rst(body, 'view', _('view:') + view) 138 138 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) 140 140 return render_to_response('admin_doc/view_detail.html', { 141 141 'name': view, 142 142 'summary': title, … … 161 161 try: 162 162 app_mod = models.get_app(app_label) 163 163 except ImproperlyConfigured: 164 raise Http404, "App %r not found"% app_label164 raise Http404, _("App %r not found") % app_label 165 165 model = None 166 166 for m in models.get_models(app_mod): 167 167 if m._meta.object_name.lower() == model_name: 168 168 model = m 169 169 break 170 170 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) 172 172 173 173 opts = model._meta 174 174 … … 180 180 if isinstance(field, models.ForeignKey): 181 181 data_type = related_object_name = field.rel.to.__name__ 182 182 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) 184 184 else: 185 185 data_type = get_readable_field_data_type(field) 186 186 verbose = field.verbose_name … … 202 202 continue 203 203 verbose = func.__doc__ 204 204 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) 206 206 fields.append({ 207 207 'name': func_name, 208 208 'data_type': get_return_data_type(func_name), … … 211 211 212 212 # Gather related objects 213 213 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) 215 215 accessor = rel.get_accessor_name() 216 216 fields.append({ 217 217 'name' : "%s.all" % accessor, 218 218 '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), 220 220 }) 221 221 fields.append({ 222 222 'name' : "%s.count" % accessor, 223 223 '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), 225 225 }) 226 226 227 227 return render_to_response('admin_doc/model_detail.html', { … … 336 336 elif hasattr(p, '_get_url_patterns'): 337 337 views.extend(extract_views_from_urlpatterns(p.url_patterns, base + p.regex.pattern)) 338 338 else: 339 raise TypeError, "%s does not appear to be a urlpattern object"% p339 raise TypeError, _("%s does not appear to be a urlpattern object") % p 340 340 return views 341 341 342 342 named_group_matcher = re.compile(r'\(\?P(<\w+>).+?\)')