Code

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

File 10436-app-name-translation-in-admin-r12676.diff, 6.8 KB (added by ramiro, 4 years ago)

Patch updated to r12676 simplify fixes taing in account fixed made in r12472.

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@@ -375,7 +375,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).title(),
10                             'app_url': app_label + '/',
11                             'has_module_perms': has_module_perms,
12                             'models': [model_dict],
13@@ -439,7 +439,7 @@
14                             # something to display, add in the necessary meta
15                             # information.
16                             app_dict = {
17-                                'name': app_label.title(),
18+                                'name': _(app_label).title(),
19                                 'app_url': '',
20                                 'has_module_perms': has_module_perms,
21                                 'models': [model_dict],
22@@ -449,7 +449,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+{{ app.name }}
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@@ -9,7 +9,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="../../../">{% trans opts.app_label|capfirst %}</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@@ -16,7 +16,7 @@
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+     <a href="../../">{% trans app_label|capfirst %}</a> &rsaquo;
64      {% if has_change_permission %}<a href="../">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} &rsaquo;
65      {% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% endif %}
66 </div>
67diff --git a/django/contrib/admin/templates/admin/change_list.html b/django/contrib/admin/templates/admin/change_list.html
68--- a/django/contrib/admin/templates/admin/change_list.html
69+++ b/django/contrib/admin/templates/admin/change_list.html
70@@ -40,7 +40,7 @@
71       </a>
72        &rsaquo;
73        <a href="../">
74-         {{ app_label|capfirst }}
75+         {% trans app_label|capfirst %}
76       </a>
77       &rsaquo;
78       {{ cl.opts.verbose_name_plural|capfirst }}
79diff --git a/django/contrib/admin/templates/admin/delete_confirmation.html b/django/contrib/admin/templates/admin/delete_confirmation.html
80--- a/django/contrib/admin/templates/admin/delete_confirmation.html
81+++ b/django/contrib/admin/templates/admin/delete_confirmation.html
82@@ -4,7 +4,7 @@
83 {% block breadcrumbs %}
84 <div class="breadcrumbs">
85      <a href="../../../../">{% trans "Home" %}</a> &rsaquo;
86-     <a href="../../../">{{ app_label|capfirst }}</a> &rsaquo;
87+     <a href="../../../">{% trans app_label|capfirst %}</a> &rsaquo;
88      <a href="../../">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
89      <a href="../">{{ object|truncatewords:"18" }}</a> &rsaquo;
90      {% trans 'Delete' %}
91diff --git a/django/contrib/admin/templates/admin/delete_selected_confirmation.html b/django/contrib/admin/templates/admin/delete_selected_confirmation.html
92--- a/django/contrib/admin/templates/admin/delete_selected_confirmation.html
93+++ b/django/contrib/admin/templates/admin/delete_selected_confirmation.html
94@@ -4,7 +4,7 @@
95 {% block breadcrumbs %}
96 <div class="breadcrumbs">
97      <a href="../../">{% trans "Home" %}</a> &rsaquo;
98-     <a href="../">{{ app_label|capfirst }}</a> &rsaquo;
99+     <a href="../">{% trans app_label|capfirst %}</a> &rsaquo;
100      <a href="./">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
101      {% trans 'Delete multiple objects' %}
102 </div>
103diff --git a/django/contrib/admin/templates/admin/index.html b/django/contrib/admin/templates/admin/index.html
104--- a/django/contrib/admin/templates/admin/index.html
105+++ b/django/contrib/admin/templates/admin/index.html
106@@ -15,8 +15,8 @@
107 {% if app_list %}
108     {% for app in app_list %}
109         <div class="module">
110-        <table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}">
111-        <caption><a href="{{ app.app_url }}" class="section">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></caption>
112+        <table summary="Models available in the {{ app.name }} application.">
113+        <caption><a href="{{ app.app_url }}" class="section">{{ app.name }}</a></caption>
114         {% for model in app.models %}
115             <tr>
116             {% if model.perms.change %}
117diff --git a/django/contrib/admin/templates/admin/object_history.html b/django/contrib/admin/templates/admin/object_history.html
118--- a/django/contrib/admin/templates/admin/object_history.html
119+++ b/django/contrib/admin/templates/admin/object_history.html
120@@ -4,7 +4,7 @@
121 {% block breadcrumbs %}
122 <div class="breadcrumbs">
123     <a href="../../../../">{% trans 'Home' %}</a> &rsaquo;
124-    <a href="../../../">{{ app_label|capfirst }}</a> &rsaquo;
125+    <a href="../../../">{% trans app_label|capfirst %}</a> &rsaquo;
126     <a href="../../">{{ module_name }}</a> &rsaquo;
127     <a href="../">{{ object|truncatewords:"18" }}</a> &rsaquo;
128     {% trans 'History' %}