Code

Ticket #10436: 10436-app-name-translation-in-admin-r10314.diff

File 10436-app-name-translation-in-admin-r10314.diff, 7.4 KB (added by ramiro, 5 years ago)

Patch with some fixes to the patch iself

Line 
1diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
2--- a/django/contrib/admin/sites.py
3+++ b/django/contrib/admin/sites.py
4@@ -318,7 +318,7 @@
5                         app_dict[app_label]['models'].append(model_dict)
6                     else:
7                         app_dict[app_label] = {
8-                            'name': app_label.title(),
9+                            'name': app_label,
10                             'app_url': app_label + '/',
11                             'has_module_perms': has_module_perms,
12                             'models': [model_dict],
13@@ -383,7 +383,7 @@
14                             # something to display, add in the necessary meta
15                             # information.
16                             app_dict = {
17-                                'name': app_label.title(),
18+                                'name': app_label,
19                                 'app_url': '',
20                                 'has_module_perms': has_module_perms,
21                                 'models': [model_dict],
22@@ -393,7 +393,7 @@
23         # Sort the models alphabetically within each app.
24         app_dict['models'].sort(lambda x, y: cmp(x['name'], y['name']))
25         context = {
26-            'title': _('%s administration') % capfirst(app_label),
27+            'title': _('%(app_label)s administration') % {'app_label': capfirst(_(app_label))},
28             'app_list': [app_dict],
29             'root_path': self.root_path,
30         }
31diff --git a/django/contrib/admin/templates/admin/app_index.html b/django/contrib/admin/templates/admin/app_index.html
32--- a/django/contrib/admin/templates/admin/app_index.html
33+++ b/django/contrib/admin/templates/admin/app_index.html
34@@ -7,7 +7,7 @@
35 <div class="breadcrumbs"><a href="../">
36 {% trans "Home" %}</a> &rsaquo;
37 {% for app in app_list %}
38-{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}
39+{% filter title %}{% trans app.name %}{% endfilter %}
40 {% endfor %}</div>{% endblock %}
41 
42 {% endif %}
43diff --git a/django/contrib/admin/templates/admin/auth/user/change_password.html b/django/contrib/admin/templates/admin/auth/user/change_password.html
44--- a/django/contrib/admin/templates/admin/auth/user/change_password.html
45+++ b/django/contrib/admin/templates/admin/auth/user/change_password.html
46@@ -8,7 +8,7 @@
47 {% block breadcrumbs %}{% if not is_popup %}
48 <div class="breadcrumbs">
49      <a href="../../../../">{% trans "Home" %}</a> &rsaquo;
50-     <a href="../../../">{{ opts.app_label|capfirst|escape }}</a> &rsaquo;
51+     <a href="../../../">{% filter capfirst %}{% trans opts.app_label %}{% endfilter %}</a> &rsaquo;
52      <a href="../../">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
53      <a href="../">{{ original|truncatewords:"18" }}</a> &rsaquo;
54      {% trans 'Change password' %}
55diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html
56--- a/django/contrib/admin/templates/admin/change_form.html
57+++ b/django/contrib/admin/templates/admin/change_form.html
58@@ -15,8 +15,8 @@
59 {% block breadcrumbs %}{% if not is_popup %}
60 <div class="breadcrumbs">
61      <a href="../../../">{% trans "Home" %}</a> &rsaquo;
62-     <a href="../../">{{ app_label|capfirst|escape }}</a> &rsaquo;
63-     {% if has_change_permission %}<a href="../">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} &rsaquo;
64+     <a href="../../">{% filter capfirst %}{% trans app_label %}{% endfilter %}</a> &rsaquo;
65+     {% if has_change_permission %}<a href="../">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} &rsaquo;
66      {% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% endif %}
67 </div>
68 {% endif %}{% endblock %}
69diff --git a/django/contrib/admin/templates/admin/change_list.html b/django/contrib/admin/templates/admin/change_list.html
70--- a/django/contrib/admin/templates/admin/change_list.html
71+++ b/django/contrib/admin/templates/admin/change_list.html
72@@ -21,7 +21,7 @@
73       </a>
74        &rsaquo;
75        <a href="../">
76-         {{ app_label|capfirst }}
77+         {% filter capfirst %}{% trans app_label %}{% endfilter %}
78       </a>
79       &rsaquo;
80       {{ cl.opts.verbose_name_plural|capfirst }}
81diff --git a/django/contrib/admin/templates/admin/delete_confirmation.html b/django/contrib/admin/templates/admin/delete_confirmation.html
82--- a/django/contrib/admin/templates/admin/delete_confirmation.html
83+++ b/django/contrib/admin/templates/admin/delete_confirmation.html
84@@ -4,7 +4,7 @@
85 {% block breadcrumbs %}
86 <div class="breadcrumbs">
87      <a href="../../../../">{% trans "Home" %}</a> &rsaquo;
88-     <a href="../../../">{{ app_label|capfirst }}</a> &rsaquo;
89+     <a href="../../../">{% filter capfirst %}{% trans app_label %}{% endfilter %}</a> &rsaquo;
90      <a href="../../">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
91      <a href="../">{{ object|truncatewords:"18" }}</a> &rsaquo;
92      {% trans 'Delete' %}
93diff --git a/django/contrib/admin/templates/admin/delete_selected_confirmation.html b/django/contrib/admin/templates/admin/delete_selected_confirmation.html
94--- a/django/contrib/admin/templates/admin/delete_selected_confirmation.html
95+++ b/django/contrib/admin/templates/admin/delete_selected_confirmation.html
96@@ -4,7 +4,7 @@
97 {% block breadcrumbs %}
98 <div class="breadcrumbs">
99      <a href="../../">{% trans "Home" %}</a> &rsaquo;
100-     <a href="../">{{ app_label|capfirst }}</a> &rsaquo;
101+     <a href="../">{% filter capfirst %}{% trans app_label %}{% endfilter %}</a> &rsaquo;
102      <a href="./">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
103      {% trans 'Delete multiple objects' %}
104 </div>
105diff --git a/django/contrib/admin/templates/admin/index.html b/django/contrib/admin/templates/admin/index.html
106--- a/django/contrib/admin/templates/admin/index.html
107+++ b/django/contrib/admin/templates/admin/index.html
108@@ -15,8 +15,8 @@
109 {% if app_list %}
110     {% for app in app_list %}
111         <div class="module">
112-        <table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}">
113-        <caption><a href="{{ app.app_url }}" class="section">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></caption>
114+        <table summary="Models available in the {{ app.name }} application.">
115+          <caption><a href="{{ app.app_url }}" class="section">{% filter title %}{% trans app.name %}{% endfilter %}</a></caption>
116         {% for model in app.models %}
117             <tr>
118             {% if model.perms.change %}
119diff --git a/django/contrib/admin/templates/admin/object_history.html b/django/contrib/admin/templates/admin/object_history.html
120--- a/django/contrib/admin/templates/admin/object_history.html
121+++ b/django/contrib/admin/templates/admin/object_history.html
122@@ -3,10 +3,10 @@
123 
124 {% block breadcrumbs %}
125 <div class="breadcrumbs">
126-    <a href="../../../../">{% trans 'Home' %}</a> &rsaquo;
127-    <a href="../../../">{{ app_label|capfirst }}</a> &rsaquo;
128-    <a href="../../">{{ module_name }}</a> &rsaquo;
129-    <a href="../">{{ object|truncatewords:"18" }}</a> &rsaquo;
130+    <a href="../../../../">{% trans 'Home' %}</a> &rsaquo;
131+    <a href="../../../">{% filter capfirst %}{% trans app_label %}{% endfilter %}</a> &rsaquo;
132+    <a href="../../">{{ module_name }}</a> &rsaquo;
133+    <a href="../">{{ object|truncatewords:"18" }}</a> &rsaquo;
134     {% trans 'History' %}
135 </div>
136 {% endblock %}