Skip to content

[Profiler][Translation] added filter. #14993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 15, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>

Expand All @@ -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>
Expand Down