Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2fcb367

Browse filesBrowse files
committed
feature #29780 [Profiler] Still show locale and fallback locale even if no trans used (ogizanagi)
This PR was squashed before being merged into the 4.3-dev branch (closes #29780). Discussion ---------- [Profiler] Still show locale and fallback locale even if no trans used | Q | A | ------------- | --- | Branch? | master <!-- see below --> | Bug fix? | no | New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | N/A <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | N/A Even if no translation is used for the current request, this information can still be valuable and displayed in the panel. ### Before ![capture d ecran 2019-01-04 a 18 03 03](https://user-images.githubusercontent.com/2211145/50701531-6933b280-104e-11e9-87a9-1f22ddfd7dc5.png) ### After ![capture d ecran 2019-01-04 a 18 01 06](https://user-images.githubusercontent.com/2211145/50701539-718bed80-104e-11e9-8293-388e9c6ee240.png) and with messages, move locales info first: ![capture d ecran 2019-01-04 a 18 01 18](https://user-images.githubusercontent.com/2211145/50701593-96806080-104e-11e9-835e-1f207f720616.png) Actually, following metrics are redundant with the tabs count. Not convinced we should duplicate it. Edit: removed --- Note we also collect the locale set into the request from the `RequestDataCollector`, but we never use it. Should we display it somewhere in the request panel? Commits ------- d80bfad [Profiler] Still show locale and fallback locale even if no trans used
2 parents 44aa362 + d80bfad commit 2fcb367
Copy full SHA for 2fcb367

File tree

1 file changed

+80
-103
lines changed
Filter options

1 file changed

+80
-103
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig
+80-103Lines changed: 80 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -56,38 +56,9 @@
5656
{% endblock %}
5757

5858
{% block panel %}
59-
{% if collector.messages is empty %}
60-
<h2>Translations</h2>
61-
<div class="empty">
62-
<p>No translations have been called.</p>
63-
</div>
64-
{% else %}
65-
{{ block('panelContent') }}
66-
{% endif %}
67-
{% endblock %}
68-
69-
{% block panelContent %}
70-
7159
<h2>Translation</h2>
7260

7361
<div class="metrics">
74-
<div class="metric">
75-
<span class="value">{{ collector.countDefines }}</span>
76-
<span class="label">Defined messages</span>
77-
</div>
78-
79-
<div class="metric">
80-
<span class="value">{{ collector.countFallbacks }}</span>
81-
<span class="label">Fallback messages</span>
82-
</div>
83-
84-
<div class="metric">
85-
<span class="value">{{ collector.countMissings }}</span>
86-
<span class="label">Missing messages</span>
87-
</div>
88-
89-
<div class="metric-divider"></div>
90-
9162
<div class="metric">
9263
<span class="value">{{ collector.locale|default('-') }}</span>
9364
<span class="label">Locale</span>
@@ -100,88 +71,94 @@
10071

10172
<h2>Messages</h2>
10273

103-
{% block messages %}
104-
105-
{# sort translation messages in groups #}
106-
{% set messages_defined, messages_missing, messages_fallback = [], [], [] %}
107-
{% for message in collector.messages %}
108-
{% if message.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_DEFINED') %}
109-
{% set messages_defined = messages_defined|merge([message]) %}
110-
{% elseif message.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_MISSING') %}
111-
{% set messages_missing = messages_missing|merge([message]) %}
112-
{% elseif message.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK') %}
113-
{% set messages_fallback = messages_fallback|merge([message]) %}
114-
{% endif %}
115-
{% endfor %}
116-
117-
<div class="sf-tabs">
118-
<div class="tab {{ collector.countMissings == 0 ? 'active' }}">
119-
<h3 class="tab-title">Defined <span class="badge">{{ collector.countDefines }}</span></h3>
120-
121-
<div class="tab-content">
122-
<p class="help">
123-
These messages are correctly translated into the given locale.
124-
</p>
125-
126-
{% if messages_defined is empty %}
127-
<div class="empty">
128-
<p>None of the used translation messages are defined for the given locale.</p>
129-
</div>
130-
{% else %}
131-
{% block defined_messages %}
132-
{{ helper.render_table(messages_defined) }}
133-
{% endblock %}
134-
{% endif %}
135-
</div>
74+
{% if collector.messages is empty %}
75+
<div class="empty">
76+
<p>No translations have been called.</p>
13677
</div>
78+
{% else %}
79+
{% block messages %}
80+
81+
{# sort translation messages in groups #}
82+
{% set messages_defined, messages_missing, messages_fallback = [], [], [] %}
83+
{% for message in collector.messages %}
84+
{% if message.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_DEFINED') %}
85+
{% set messages_defined = messages_defined|merge([message]) %}
86+
{% elseif message.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_MISSING') %}
87+
{% set messages_missing = messages_missing|merge([message]) %}
88+
{% elseif message.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK') %}
89+
{% set messages_fallback = messages_fallback|merge([message]) %}
90+
{% endif %}
91+
{% endfor %}
92+
93+
<div class="sf-tabs">
94+
<div class="tab {{ collector.countMissings == 0 ? 'active' }}">
95+
<h3 class="tab-title">Defined <span class="badge">{{ collector.countDefines }}</span></h3>
96+
97+
<div class="tab-content">
98+
<p class="help">
99+
These messages are correctly translated into the given locale.
100+
</p>
137101

138-
<div class="tab">
139-
<h3 class="tab-title">Fallback <span class="badge {{ collector.countFallbacks ? 'status-warning' }}">{{ collector.countFallbacks }}</span></h3>
140-
141-
<div class="tab-content">
142-
<p class="help">
143-
These messages are not available for the given locale
144-
but Symfony found them in the fallback locale catalog.
145-
</p>
146-
147-
{% if messages_fallback is empty %}
148-
<div class="empty">
149-
<p>No fallback translation messages were used.</p>
150-
</div>
151-
{% else %}
152-
{% block fallback_messages %}
153-
{{ helper.render_table(messages_fallback) }}
154-
{% endblock %}
155-
{% endif %}
102+
{% if messages_defined is empty %}
103+
<div class="empty">
104+
<p>None of the used translation messages are defined for the given locale.</p>
105+
</div>
106+
{% else %}
107+
{% block defined_messages %}
108+
{{ helper.render_table(messages_defined) }}
109+
{% endblock %}
110+
{% endif %}
111+
</div>
156112
</div>
157-
</div>
158113

159-
<div class="tab {{ collector.countMissings > 0 ? 'active' }}">
160-
<h3 class="tab-title">Missing <span class="badge {{ collector.countMissings ? 'status-error' }}">{{ collector.countMissings }}</span></h3>
161-
162-
<div class="tab-content">
163-
<p class="help">
164-
These messages are not available for the given locale and cannot
165-
be found in the fallback locales. Add them to the translation
166-
catalogue to avoid Symfony outputting untranslated contents.
167-
</p>
168-
169-
{% if messages_missing is empty %}
170-
<div class="empty">
171-
<p>There are no messages of this category.</p>
172-
</div>
173-
{% else %}
174-
{% block missing_messages %}
175-
{{ helper.render_table(messages_missing) }}
176-
{% endblock %}
177-
{% endif %}
114+
<div class="tab">
115+
<h3 class="tab-title">Fallback <span class="badge {{ collector.countFallbacks ? 'status-warning' }}">{{ collector.countFallbacks }}</span></h3>
116+
117+
<div class="tab-content">
118+
<p class="help">
119+
These messages are not available for the given locale
120+
but Symfony found them in the fallback locale catalog.
121+
</p>
122+
123+
{% if messages_fallback is empty %}
124+
<div class="empty">
125+
<p>No fallback translation messages were used.</p>
126+
</div>
127+
{% else %}
128+
{% block fallback_messages %}
129+
{{ helper.render_table(messages_fallback) }}
130+
{% endblock %}
131+
{% endif %}
132+
</div>
133+
</div>
134+
135+
<div class="tab {{ collector.countMissings > 0 ? 'active' }}">
136+
<h3 class="tab-title">Missing <span class="badge {{ collector.countMissings ? 'status-error' }}">{{ collector.countMissings }}</span></h3>
137+
138+
<div class="tab-content">
139+
<p class="help">
140+
These messages are not available for the given locale and cannot
141+
be found in the fallback locales. Add them to the translation
142+
catalogue to avoid Symfony outputting untranslated contents.
143+
</p>
144+
145+
{% if messages_missing is empty %}
146+
<div class="empty">
147+
<p>There are no messages of this category.</p>
148+
</div>
149+
{% else %}
150+
{% block missing_messages %}
151+
{{ helper.render_table(messages_missing) }}
152+
{% endblock %}
153+
{% endif %}
154+
</div>
178155
</div>
179156
</div>
180-
</div>
181157

182-
<script>Sfjs.createFilters();</script>
158+
<script>Sfjs.createFilters();</script>
183159

184-
{% endblock messages %}
160+
{% endblock messages %}
161+
{% endif %}
185162

186163
{% endblock %}
187164

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.