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.
This commit is contained in:
Fabien Potencier 2015-06-15 16:44:02 +02:00
commit 15ff8652b8

View File

@ -57,6 +57,14 @@
{% endblock %}
{% block panelContent %}
{% set filter = request.query.get('state', '-1') %}
{% set filterOptions = {
'-1': '',
(constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_DEFINED')): 'Defined messages',
(constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_MISSING')): 'Missing messages',
(constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK')): 'Fallback messages',
} %}
<h2>Translation Stats</h2>
<table>
<tbody>
@ -72,6 +80,22 @@
<th>Missing messages</th>
<td><pre>{{ collector.countMissings }}</pre></td>
</tr>
<tr>
<th>Filter</th>
<td>
<form id="filter-form" action="" method="get" style="display: inline">
<input type="hidden" name="panel" value="translation">
<select id="filter" name="state" onchange="document.getElementById('filter-form').submit(); ">
{% for key,option in filterOptions %}
<option value="{{ key }}"{{ filter == key ? ' selected' : '' }}>{{ option }}</option>
{% endfor %}
</select>
<noscript>
<input type="submit" value="refresh">
</noscript>
</form>
</td>
</tr>
</tbody>
</table>
@ -83,7 +107,7 @@
<th>Id</th>
<th>Message Preview</th>
</tr>
{% for message in collector.messages %}
{% for message in collector.messages if message.state == filter or filter == '-1' %}
<tr>
<td><code>{{ translator.state(message) }}</code></td>
<td><code>{{ message.locale }}</code></td>