Skip to content

Commit 8583da5

Browse files
committed
[Profiler][Translation] added filter.
1 parent 5f36605 commit 8583da5

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@
5757
{% endblock %}
5858

5959
{% block panelContent %}
60+
{% set value = request.query.get('message-type', '-1') %}
61+
{% set filterOptions = {
62+
'-1': '',
63+
(constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_DEFINED')): 'Defined messages',
64+
(constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_MISSING')): 'Missing messages',
65+
(constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK')): 'Fallback messages',
66+
} %}
67+
6068
<h2>Translation Stats</h2>
6169
<table>
6270
<tbody>
@@ -72,6 +80,22 @@
7280
<th>Missing messages</th>
7381
<td><pre>{{ collector.countMissings }}</pre></td>
7482
</tr>
83+
<tr>
84+
<th>Filter</th>
85+
<td>
86+
<form id="filter-form" action="" method="get" style="display: inline">
87+
<input type="hidden" name="panel" value="translation">
88+
<select id="filter" name="message-type" onchange="document.getElementById('filter-form').submit(); ">
89+
{% for key,option in filterOptions %}
90+
<option value="{{ key }}"{{ value == key ? ' selected' : '' }}>{{ option }}</option>
91+
{% endfor %}
92+
</select>
93+
<noscript>
94+
<input type="submit" value="refresh">
95+
</noscript>
96+
</form>
97+
</td>
98+
</tr>
7599
</tbody>
76100
</table>
77101

@@ -83,7 +107,7 @@
83107
<th>Id</th>
84108
<th>Message Preview</th>
85109
</tr>
86-
{% for message in collector.messages %}
110+
{% for message in collector.messages if message.state == value or value == "-1" %}
87111
<tr>
88112
<td><code>{{ translator.state(message) }}</code></td>
89113
<td><code>{{ message.locale }}</code></td>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy