|
| 1 | +{% extends '@WebProfiler/Profiler/layout.html.twig' %} |
| 2 | + |
| 3 | +{% import _self as translator %} |
| 4 | + |
| 5 | +{% block toolbar %} |
| 6 | + {% if collector.messages|length %} |
| 7 | + {% set icon %} |
| 8 | + <svg width="28" height="28" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 417 300" enable-background="new 0 0 417 300" xml:space="preserve"><g id="Layer_1_1_"><g id="outline_1_"><path fill="#B5B5B6" d="M275.9,145c0,18.2-14.799,33-33,33H120.701l-36.3,42l-0.3-42H40c-18.2,0-33-14.8-33-33V44c0-18.2,14.8-33,33-33h202.9c18.199,0,33,14.8,33,33V145L275.9,145z"/></g><g enable-background="new"><path fill="#FFFFFF" d="M194.501,146.962h-23.898l-9.5-24.715h-43.492l-8.98,24.715H85.326l42.379-108.805h23.23L194.501,146.962zM154.052,103.915L139.06,63.54l-14.695,40.375H154.052z"/></g></g><g id="Layer_2_1_"><g id="japanese"><g id="outline"><path fill="#414141" d="M141.451,214c0,18.2,14.8,33,33,33h122.2l36.301,42l0.301-42h44.1c18.201,0,33-14.8,33-33V113c0-18.2-14.799-33-33-33H174.453c-18.201,0-33,14.8-33,33L141.451,214L141.451,214z"/></g><g enable-background="new"><path fill="#FFFFFF" d="M312.158,143.327c-0.455,1.672-0.912,3.344-1.215,5.016c22.039,6.08,31.766,21.431,31.766,38.455c0,24.318-18.238,40.733-57.301,45.598c-1.217-3.952-5.016-11.248-7.904-15.352c27.359-3.04,45.295-12.159,45.295-29.791c0-5.016-1.672-16.871-18.088-22.19c-6.688,15.199-16.871,29.335-28.727,39.519c0.607,1.976,1.367,3.647,2.127,5.167l-15.654,10.032c-0.76-1.521-1.52-3.192-2.129-5.017c-7.6,4.256-15.959,6.992-24.471,6.992c-13.375,0-22.189-8.512-22.189-22.647c0-20.975,16.111-37.542,37.693-46.357c-0.305-6.536-0.305-13.223-0.305-20.215c-11.398,0.304-23.711,0.608-29.789,0.456l-0.912-17.783c6.99,0.152,19.758,0.152,31.006,0.152c0.305-6.536,0.457-14.135,0.76-20.519l23.863,1.824c-0.305,1.52-1.52,2.736-4.104,3.04c-0.457,4.408-0.76,10.184-1.217,15.047c16.568-0.76,37.391-2.736,54.262-6.384l1.672,18.391c-16.719,3.04-38.605,4.56-56.846,5.168c-0.15,5.319-0.303,10.487-0.303,15.503c6.383-1.52,15.654-2.432,22.799-1.976c0.607-2.28,1.063-4.56,1.215-6.84L312.158,143.327z M255.77,198.044c-1.672-8.056-2.736-17.479-3.496-27.814c-12.008,5.927-20.215,15.199-20.215,25.382c0,8.664,6.535,8.36,8.512,8.209C245.281,203.668,250.449,201.539,255.77,198.044zM286.473,162.021c-2.129-0.304-10.033,0.305-16.871,2.128c0.455,7.6,0.91,14.591,1.975,20.671C277.504,178.589,282.672,170.686,286.473,162.021z"/></g></g></g></svg> |
| 9 | + {% if collector.countMissings %} |
| 10 | + {% set status_color = "red" %} |
| 11 | + {% elseif collector.countFallbacks %} |
| 12 | + {% set status_color = "yellow" %} |
| 13 | + {% endif %} |
| 14 | + {% set error_count = collector.countMissings + collector.countFallbacks %} |
| 15 | + <span class="sf-toolbar-status{% if status_color is defined %} sf-toolbar-status-{{ status_color }}{% endif %}">{{ error_count ?: collector.countdefines }}</span> |
| 16 | + {% endset %} |
| 17 | + {% set text %} |
| 18 | + {% if collector.countMissings %} |
| 19 | + <div class="sf-toolbar-info-piece"> |
| 20 | + <b>Missing messages</b> |
| 21 | + <span class="sf-toolbar-status sf-toolbar-status-red">{{ collector.countMissings }}</span> |
| 22 | + </div> |
| 23 | + {% endif %} |
| 24 | + {% if collector.countFallbacks %} |
| 25 | + <div class="sf-toolbar-info-piece"> |
| 26 | + <b>Fallback messages</b> |
| 27 | + <span class="sf-toolbar-status sf-toolbar-status-yellow">{{ collector.countFallbacks }}</span> |
| 28 | + </div> |
| 29 | + {% endif %} |
| 30 | + {% if collector.countdefines %} |
| 31 | + <div class="sf-toolbar-info-piece"> |
| 32 | + <b>Defined messages</b> |
| 33 | + <span class="sf-toolbar-status sf-toolbar-status-green">{{ collector.countdefines }}</span> |
| 34 | + </div> |
| 35 | + {% endif %} |
| 36 | + {% endset %} |
| 37 | + {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': profiler_url } %} |
| 38 | + {% endif %} |
| 39 | +{% endblock %} |
| 40 | + |
| 41 | +{% block menu %} |
| 42 | +<span class="label"> |
| 43 | + <span class="icon"><svg width="35" height="28" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 417 300" enable-background="new 0 0 417 300" xml:space="preserve"><g id="Layer_1_1_"><g id="outline_1_"><path fill="#B5B5B6" d="M275.9,145c0,18.2-14.799,33-33,33H120.701l-36.3,42l-0.3-42H40c-18.2,0-33-14.8-33-33V44c0-18.2,14.8-33,33-33h202.9c18.199,0,33,14.8,33,33V145L275.9,145z"/></g><g enable-background="new"><path fill="#FFFFFF" d="M194.501,146.962h-23.898l-9.5-24.715h-43.492l-8.98,24.715H85.326l42.379-108.805h23.23L194.501,146.962zM154.052,103.915L139.06,63.54l-14.695,40.375H154.052z"/></g></g><g id="Layer_2_1_"><g id="japanese"><g id="outline"><path fill="#414141" d="M141.451,214c0,18.2,14.8,33,33,33h122.2l36.301,42l0.301-42h44.1c18.201,0,33-14.8,33-33V113c0-18.2-14.799-33-33-33H174.453c-18.201,0-33,14.8-33,33L141.451,214L141.451,214z"/></g><g enable-background="new"><path fill="#FFFFFF" d="M312.158,143.327c-0.455,1.672-0.912,3.344-1.215,5.016c22.039,6.08,31.766,21.431,31.766,38.455c0,24.318-18.238,40.733-57.301,45.598c-1.217-3.952-5.016-11.248-7.904-15.352c27.359-3.04,45.295-12.159,45.295-29.791c0-5.016-1.672-16.871-18.088-22.19c-6.688,15.199-16.871,29.335-28.727,39.519c0.607,1.976,1.367,3.647,2.127,5.167l-15.654,10.032c-0.76-1.521-1.52-3.192-2.129-5.017c-7.6,4.256-15.959,6.992-24.471,6.992c-13.375,0-22.189-8.512-22.189-22.647c0-20.975,16.111-37.542,37.693-46.357c-0.305-6.536-0.305-13.223-0.305-20.215c-11.398,0.304-23.711,0.608-29.789,0.456l-0.912-17.783c6.99,0.152,19.758,0.152,31.006,0.152c0.305-6.536,0.457-14.135,0.76-20.519l23.863,1.824c-0.305,1.52-1.52,2.736-4.104,3.04c-0.457,4.408-0.76,10.184-1.217,15.047c16.568-0.76,37.391-2.736,54.262-6.384l1.672,18.391c-16.719,3.04-38.605,4.56-56.846,5.168c-0.15,5.319-0.303,10.487-0.303,15.503c6.383-1.52,15.654-2.432,22.799-1.976c0.607-2.28,1.063-4.56,1.215-6.84L312.158,143.327z M255.77,198.044c-1.672-8.056-2.736-17.479-3.496-27.814c-12.008,5.927-20.215,15.199-20.215,25.382c0,8.664,6.535,8.36,8.512,8.209C245.281,203.668,250.449,201.539,255.77,198.044zM286.473,162.021c-2.129-0.304-10.033,0.305-16.871,2.128c0.455,7.6,0.91,14.591,1.975,20.671C277.504,178.589,282.672,170.686,286.473,162.021z"/></g></g></g></svg></span> |
| 44 | + <strong>Translation</strong> |
| 45 | +</span> |
| 46 | +{% endblock %} |
| 47 | + |
| 48 | +{% block panel %} |
| 49 | + {% if collector.messages is empty %} |
| 50 | + <h2>Translations</h2> |
| 51 | + <p> |
| 52 | + <em>No translations have been called.</em> |
| 53 | + </p> |
| 54 | + {% else %} |
| 55 | + {{ block('panelContent') }} |
| 56 | + {% endif %} |
| 57 | +{% endblock %} |
| 58 | + |
| 59 | +{% block panelContent %} |
| 60 | + <h2>Called Translations</h2> |
| 61 | + <ul> |
| 62 | + <li><strong>Defined messages: {{ collector.countdefines }}</strong></li> |
| 63 | + <li><strong>Fallback messages: {{ collector.countFallbacks }}</strong></li> |
| 64 | + <li><strong>Missing messages: {{ collector.countMissings }}</strong></li> |
| 65 | + </ul> |
| 66 | + |
| 67 | + <table> |
| 68 | + <tr> |
| 69 | + <th>State</th> |
| 70 | + <th>Locale</th> |
| 71 | + <th>Domain</th> |
| 72 | + <th>Id</th> |
| 73 | + <th>Message Preview</th> |
| 74 | + </tr> |
| 75 | + {% for message in collector.messages %} |
| 76 | + <tr> |
| 77 | + <td><code>{{ translator.state(message) }}</code></td> |
| 78 | + <td><code>{{ message.locale }}</code></td> |
| 79 | + <td><code>{{ message.domain }}</code></td> |
| 80 | + <td><code>{{ message.id }}</code></td> |
| 81 | + <td><code>{{ message.translation }}</code></td> |
| 82 | + </tr> |
| 83 | + {% endfor %} |
| 84 | + </table> |
| 85 | +{% endblock %} |
| 86 | + |
| 87 | +{% macro state(translation) %} |
| 88 | + {% if translation.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK') %} |
| 89 | + same as fallback |
| 90 | + {% elseif translation.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_MISSING') %} |
| 91 | + missing |
| 92 | + {% endif %} |
| 93 | +{% endmacro %} |
0 commit comments