Skip to content

Commit 15ff865

Browse files
committed
feature #14993 [Profiler][Translation] added filter. (aitboudad)
This PR was merged into the 2.8 branch. Discussion ---------- [Profiler][Translation] added filter. | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Fixed tickets | ~ | Tests pass? | yes | License | MIT ![selection_017](https://cloud.githubusercontent.com/assets/1753742/8159914/c2c8ad68-135a-11e5-9ae3-f2e055ea3230.jpg) Commits ------- 65f9291 [Profiler][Translation] added filter.
2 parents 5f36605 + 65f9291 commit 15ff865

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 filter = request.query.get('state', '-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="state" onchange="document.getElementById('filter-form').submit(); ">
89+
{% for key,option in filterOptions %}
90+
<option value="{{ key }}"{{ filter == 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 == filter or filter == '-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