Skip to content

Commit

Permalink
feature #425 Translate the error (and errors) label of forms (thomasb…
Browse files Browse the repository at this point in the history
…eaujean, javiereguiluz)

This PR was merged into the master branch.

Discussion
----------

Translate the error (and errors) label of forms

Commits
-------

810e1be Minor tweaks for the template code
fc6b4dc Updated more translations
1227d31 Simplified translation files
e823768 Use transchoice for error translation
af4cf07 Fix: it is the error message that must be used for one error
cd294c6 Translate the error (and errors) label of forms
  • Loading branch information
javiereguiluz committed Sep 1, 2015
2 parents ff6f5ef + 810e1be commit 9d32134
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
3 changes: 3 additions & 0 deletions Resources/translations/EasyAdminBundle.en.xlf
Expand Up @@ -116,6 +116,9 @@
<trans-unit id="action.add_another_item">
<source>action.add_another_item</source>
<target>Add another item</target>
<trans-unit id="errors">
<source>errors</source>
<target>Error|Errors</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 4 additions & 0 deletions Resources/translations/EasyAdminBundle.es.xlf
Expand Up @@ -109,6 +109,10 @@
<source>delete_modal.content</source>
<target>Esta acción no se puede deshacer.</target>
</trans-unit>
<trans-unit id="errors">
<source>errors</source>
<target>Error|Errores</target>
</trans-unit>
</body>
</file>
</xliff>
4 changes: 4 additions & 0 deletions Resources/translations/EasyAdminBundle.eu.xlf
Expand Up @@ -109,6 +109,10 @@
<source>delete_modal.content</source>
<target>Ekintza hau ezin da desegin.</target>
</trans-unit>
<trans-unit id="errors">
<source>errors</source>
<target>Hutsa|Hutsak</target>
</trans-unit>
</body>
</file>
</xliff>
3 changes: 3 additions & 0 deletions Resources/translations/EasyAdminBundle.fr.xlf
Expand Up @@ -116,6 +116,9 @@
<trans-unit id="action.add_another_item">
<source>action.add_another_item</source>
<target>Ajouter un autre élément</target>
<trans-unit id="errors">
<source>errors</source>
<target>Erreur|Erreurs</target>
</trans-unit>
</body>
</file>
Expand Down
23 changes: 12 additions & 11 deletions Resources/views/form/bootstrap_3_layout.html.twig
Expand Up @@ -232,18 +232,19 @@
{# Errors #}

{% block form_errors %}
{% if errors|length > 1 %}
{% set error_count = errors|length %}
{% if error_count >= 1 %}
<div class="error-block">
<span class="label label-danger">{{ errors|length }} ERRORS</span>
<ul>
{% for error in errors %}
<li>{{ error.message }}</li>
{% endfor %}
</ul>
</div>
{% elseif errors|length == 1 %}
<div class="error-block">
<span class="label label-danger">ERROR</span> {{ errors|first.message }}
<span class="label label-danger">{{ 'errors'|transchoice(error_count) }}</span>
{% if error_count == 1 %}
{{ errors|first.message }}
{% else %}
<ul>
{% for error in errors %}
<li>{{ error.message }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endif %}
{% endblock form_errors %}

0 comments on commit 9d32134

Please sign in to comment.