Skip to content

Commit d672919

Browse files
committed
Format the templates using djade
1 parent 66361c5 commit d672919

33 files changed

+148
-136
lines changed

.pre-commit-config.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ repos:
1818
hooks:
1919
- id: django-upgrade
2020
args: [--target-version, "4.2"]
21+
- repo: https://github.com/adamchainz/djade-pre-commit
22+
rev: "1.3.2"
23+
hooks:
24+
- id: djade
25+
args: [--target-version, "4.2"]
2126
- repo: https://github.com/pre-commit/pygrep-hooks
2227
rev: v1.10.0
2328
hooks:

debug_toolbar/templates/debug_toolbar/base.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
{% block css %}
33
<link{% if toolbar.csp_nonce %} nonce="{{ toolbar.csp_nonce }}"{% endif %} rel="stylesheet" href="{% static 'debug_toolbar/css/print.css' %}" media="print">
44
<link{% if toolbar.csp_nonce %} nonce="{{ toolbar.csp_nonce }}"{% endif %} rel="stylesheet" href="{% static 'debug_toolbar/css/toolbar.css' %}">
5-
{% endblock %}
5+
{% endblock css %}
66
{% block js %}
77
<script{% if toolbar.csp_nonce %} nonce="{{ toolbar.csp_nonce }}"{% endif %} type="module" src="{% static 'debug_toolbar/js/toolbar.js' %}" async></script>
8-
{% endblock %}
8+
{% endblock js %}
99
<div id="djDebug" class="djdt-hidden" dir="ltr"
1010
{% if not toolbar.should_render_panels %}
1111
data-store-id="{{ toolbar.store_id }}"
@@ -19,10 +19,10 @@
1919
{{ toolbar.config.ROOT_TAG_EXTRA_ATTRS|safe }} data-update-on-fetch="{{ toolbar.config.UPDATE_ON_FETCH }}">
2020
<div class="djdt-hidden" id="djDebugToolbar">
2121
<ul id="djDebugPanelList">
22-
<li><a id="djHideToolBarButton" href="#" title="{% trans 'Hide toolbar' %}">{% trans "Hide" %} »</a></li>
22+
<li><a id="djHideToolBarButton" href="#" title="{% translate 'Hide toolbar' %}">{% translate "Hide" %} »</a></li>
2323
<li>
24-
<a id="djToggleThemeButton" href="#" title="{% trans 'Toggle Theme' %}">
25-
{% trans "Toggle Theme" %} {% include "debug_toolbar/includes/theme_selector.html" %}
24+
<a id="djToggleThemeButton" href="#" title="{% translate 'Toggle Theme' %}">
25+
{% translate "Toggle Theme" %} {% include "debug_toolbar/includes/theme_selector.html" %}
2626
</a>
2727
</li>
2828
{% for panel in toolbar.panels %}
@@ -31,7 +31,7 @@
3131
</ul>
3232
</div>
3333
<div class="djdt-hidden" id="djDebugToolbarHandle">
34-
<div title="{% trans 'Show toolbar' %}" id="djShowToolBarButton">
34+
<div title="{% translate 'Show toolbar' %}" id="djShowToolBarButton">
3535
<span id="djShowToolBarD">D</span><span id="djShowToolBarJ">J</span>DT
3636
</div>
3737
</div>

debug_toolbar/templates/debug_toolbar/includes/panel_button.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{% load i18n %}
22

33
<li id="djdt-{{ panel.panel_id }}" class="djDebugPanelButton">
4-
<input type="checkbox" data-cookie="djdt{{ panel.panel_id }}" {% if panel.enabled %}checked title="{% trans "Disable for next and successive requests" %}"{% else %}title="{% trans "Enable for next and successive requests" %}"{% endif %}>
4+
<input type="checkbox" data-cookie="djdt{{ panel.panel_id }}" {% if panel.enabled %}checked title="{% translate "Disable for next and successive requests" %}"{% else %}title="{% translate "Enable for next and successive requests" %}"{% endif %}>
55
{% if panel.has_content and panel.enabled %}
66
<a href="#" title="{{ panel.title }}" class="{{ panel.panel_id }}">
77
{% else %}
88
<div class="djdt-contentless{% if not panel.enabled %} djdt-disabled{% endif %}">
99
{% endif %}
1010
{{ panel.nav_title }}
1111
{% if panel.enabled %}
12-
{% with panel.nav_subtitle as subtitle %}
12+
{% with subtitle=panel.nav_subtitle %}
1313
{% if subtitle %}<br><small>{{ subtitle }}</small>{% endif %}
1414
{% endwith %}
1515
{% endif %}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{% load i18n %}
22

33
{% if alerts %}
4-
<h4>{% trans "Alerts found" %}</h4>
4+
<h4>{% translate "Alerts found" %}</h4>
55
{% for alert in alerts %}
66
<ul>
77
<li>{{ alert.alert }}</li>
88
</ul>
99
{% endfor %}
1010
{% else %}
11-
<h4>{% trans "No alerts found" %}</h4>
11+
<h4>{% translate "No alerts found" %}</h4>
1212
{% endif %}

debug_toolbar/templates/debug_toolbar/panels/cache.html

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{% load i18n %}
2-
<h4>{% trans "Summary" %}</h4>
2+
<h4>{% translate "Summary" %}</h4>
33
<table>
44
<thead>
55
<tr>
6-
<th>{% trans "Total calls" %}</th>
7-
<th>{% trans "Total time" %}</th>
8-
<th>{% trans "Cache hits" %}</th>
9-
<th>{% trans "Cache misses" %}</th>
6+
<th>{% translate "Total calls" %}</th>
7+
<th>{% translate "Total time" %}</th>
8+
<th>{% translate "Cache hits" %}</th>
9+
<th>{% translate "Cache misses" %}</th>
1010
</tr>
1111
</thead>
1212
<tbody>
@@ -18,7 +18,7 @@ <h4>{% trans "Summary" %}</h4>
1818
</tr>
1919
</tbody>
2020
</table>
21-
<h4>{% trans "Commands" %}</h4>
21+
<h4>{% translate "Commands" %}</h4>
2222
<table>
2323
<thead>
2424
<tr>
@@ -36,15 +36,15 @@ <h4>{% trans "Commands" %}</h4>
3636
</tbody>
3737
</table>
3838
{% if calls %}
39-
<h4>{% trans "Calls" %}</h4>
39+
<h4>{% translate "Calls" %}</h4>
4040
<table>
4141
<thead>
4242
<tr>
43-
<th colspan="2">{% trans "Time (ms)" %}</th>
44-
<th>{% trans "Type" %}</th>
45-
<th>{% trans "Arguments" %}</th>
46-
<th>{% trans "Keyword arguments" %}</th>
47-
<th>{% trans "Backend" %}</th>
43+
<th colspan="2">{% translate "Time (ms)" %}</th>
44+
<th>{% translate "Type" %}</th>
45+
<th>{% translate "Arguments" %}</th>
46+
<th>{% translate "Keyword arguments" %}</th>
47+
<th>{% translate "Backend" %}</th>
4848
</tr>
4949
</thead>
5050
<tbody>

debug_toolbar/templates/debug_toolbar/panels/headers.html

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{% load i18n %}
22

3-
<h4>{% trans "Request headers" %}</h4>
3+
<h4>{% translate "Request headers" %}</h4>
44

55
<table>
66
<thead>
77
<tr>
8-
<th>{% trans "Key" %}</th>
9-
<th>{% trans "Value" %}</th>
8+
<th>{% translate "Key" %}</th>
9+
<th>{% translate "Value" %}</th>
1010
</tr>
1111
</thead>
1212
<tbody>
@@ -19,13 +19,13 @@ <h4>{% trans "Request headers" %}</h4>
1919
</tbody>
2020
</table>
2121

22-
<h4>{% trans "Response headers" %}</h4>
22+
<h4>{% translate "Response headers" %}</h4>
2323

2424
<table>
2525
<thead>
2626
<tr>
27-
<th>{% trans "Key" %}</th>
28-
<th>{% trans "Value" %}</th>
27+
<th>{% translate "Key" %}</th>
28+
<th>{% translate "Value" %}</th>
2929
</tr>
3030
</thead>
3131
<tbody>
@@ -38,15 +38,15 @@ <h4>{% trans "Response headers" %}</h4>
3838
</tbody>
3939
</table>
4040

41-
<h4>{% trans "WSGI environ" %}</h4>
41+
<h4>{% translate "WSGI environ" %}</h4>
4242

43-
<p>{% trans "Since the WSGI environ inherits the environment of the server, only a significant subset is shown below." %}</p>
43+
<p>{% translate "Since the WSGI environ inherits the environment of the server, only a significant subset is shown below." %}</p>
4444

4545
<table>
4646
<thead>
4747
<tr>
48-
<th>{% trans "Key" %}</th>
49-
<th>{% trans "Value" %}</th>
48+
<th>{% translate "Key" %}</th>
49+
<th>{% translate "Value" %}</th>
5050
</tr>
5151
</thead>
5252
<tbody>

debug_toolbar/templates/debug_toolbar/panels/history.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
{% load i18n %}{% load static %}
1+
{% load i18n static %}
22
<form method="get" action="{% url 'djdt:history_refresh' %}">
33
{{ refresh_form.as_div }}
44
<button class="refreshHistory">Refresh</button>
55
</form>
66
<table class="djdt-max-height-100">
77
<thead>
88
<tr>
9-
<th>{% trans "Time" %}</th>
10-
<th>{% trans "Method" %}</th>
11-
<th>{% trans "Path" %}</th>
12-
<th>{% trans "Request Variables" %}</th>
13-
<th>{% trans "Status" %}</th>
14-
<th>{% trans "Action" %}</th>
9+
<th>{% translate "Time" %}</th>
10+
<th>{% translate "Method" %}</th>
11+
<th>{% translate "Path" %}</th>
12+
<th>{% translate "Request Variables" %}</th>
13+
<th>{% translate "Status" %}</th>
14+
<th>{% translate "Action" %}</th>
1515
</tr>
1616
</thead>
1717
<tbody id="djdtHistoryRequests">

debug_toolbar/templates/debug_toolbar/panels/history_tr.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
</colgroup>
2020
<thead>
2121
<tr>
22-
<th>{% trans "Variable" %}</th>
23-
<th>{% trans "Value" %}</th>
22+
<th>{% translate "Variable" %}</th>
23+
<th>{% translate "Value" %}</th>
2424
</tr>
2525
</thead>
2626
<tbody>

debug_toolbar/templates/debug_toolbar/panels/profiling.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<table>
33
<thead>
44
<tr>
5-
<th>{% trans "Call" %}</th>
6-
<th>{% trans "CumTime" %}</th>
7-
<th>{% trans "Per" %}</th>
8-
<th>{% trans "TotTime" %}</th>
9-
<th>{% trans "Per" %}</th>
10-
<th>{% trans "Count" %}</th>
5+
<th>{% translate "Call" %}</th>
6+
<th>{% translate "CumTime" %}</th>
7+
<th>{% translate "Per" %}</th>
8+
<th>{% translate "TotTime" %}</th>
9+
<th>{% translate "Per" %}</th>
10+
<th>{% translate "Count" %}</th>
1111
</tr>
1212
</thead>
1313
<tbody>
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{% load i18n %}
22

3-
<h4>{% trans "View information" %}</h4>
3+
<h4>{% translate "View information" %}</h4>
44
<table>
55
<thead>
66
<tr>
7-
<th>{% trans "View function" %}</th>
8-
<th>{% trans "Arguments" %}</th>
9-
<th>{% trans "Keyword arguments" %}</th>
10-
<th>{% trans "URL name" %}</th>
7+
<th>{% translate "View function" %}</th>
8+
<th>{% translate "Arguments" %}</th>
9+
<th>{% translate "Keyword arguments" %}</th>
10+
<th>{% translate "URL name" %}</th>
1111
</tr>
1212
</thead>
1313
<tbody>
@@ -21,29 +21,29 @@ <h4>{% trans "View information" %}</h4>
2121
</table>
2222

2323
{% if cookies.list or cookies.raw %}
24-
<h4>{% trans "Cookies" %}</h4>
24+
<h4>{% translate "Cookies" %}</h4>
2525
{% include 'debug_toolbar/panels/request_variables.html' with variables=cookies %}
2626
{% else %}
27-
<h4>{% trans "No cookies" %}</h4>
27+
<h4>{% translate "No cookies" %}</h4>
2828
{% endif %}
2929

3030
{% if session.list or session.raw %}
31-
<h4>{% trans "Session data" %}</h4>
31+
<h4>{% translate "Session data" %}</h4>
3232
{% include 'debug_toolbar/panels/request_variables.html' with variables=session %}
3333
{% else %}
34-
<h4>{% trans "No session data" %}</h4>
34+
<h4>{% translate "No session data" %}</h4>
3535
{% endif %}
3636

3737
{% if get.list or get.raw %}
38-
<h4>{% trans "GET data" %}</h4>
38+
<h4>{% translate "GET data" %}</h4>
3939
{% include 'debug_toolbar/panels/request_variables.html' with variables=get %}
4040
{% else %}
41-
<h4>{% trans "No GET data" %}</h4>
41+
<h4>{% translate "No GET data" %}</h4>
4242
{% endif %}
4343

4444
{% if post.list or post.raw %}
45-
<h4>{% trans "POST data" %}</h4>
45+
<h4>{% translate "POST data" %}</h4>
4646
{% include 'debug_toolbar/panels/request_variables.html' with variables=post %}
4747
{% else %}
48-
<h4>{% trans "No POST data" %}</h4>
48+
<h4>{% translate "No POST data" %}</h4>
4949
{% endif %}

debug_toolbar/templates/debug_toolbar/panels/request_variables.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
</colgroup>
99
<thead>
1010
<tr>
11-
<th>{% trans "Variable" %}</th>
12-
<th>{% trans "Value" %}</th>
11+
<th>{% translate "Variable" %}</th>
12+
<th>{% translate "Value" %}</th>
1313
</tr>
1414
</thead>
1515
<tbody>

debug_toolbar/templates/debug_toolbar/panels/settings.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<table>
33
<thead>
44
<tr>
5-
<th>{% trans "Setting" %}</th>
6-
<th>{% trans "Value" %}</th>
5+
<th>{% translate "Setting" %}</th>
6+
<th>{% translate "Value" %}</th>
77
</tr>
88
</thead>
99
<tbody>

debug_toolbar/templates/debug_toolbar/panels/signals.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<table>
33
<thead>
44
<tr>
5-
<th>{% trans "Signal" %}</th>
6-
<th>{% trans "Receivers" %}</th>
5+
<th>{% translate "Signal" %}</th>
6+
<th>{% translate "Receivers" %}</th>
77
</tr>
88
</thead>
99
<tbody>

0 commit comments

Comments
 (0)