[FrameworkBundle], [TwigBundle] added support for form error message pluralization
This commit is contained in:
parent
7a6376eb29
commit
c0715f1235
@ -250,7 +250,13 @@
|
||||
{% if errors|length > 0 %}
|
||||
<ul>
|
||||
{% for error in errors %}
|
||||
<li>{{ error.messageTemplate|trans(error.messageParameters, 'validators') }}</li>
|
||||
<li>{{
|
||||
error.messagePluralization is null
|
||||
?
|
||||
error.messageTemplate|trans(error.messageParameters, 'validators')
|
||||
:
|
||||
error.messageTemplate|transchoice(error.messagePluralization, error.messageParameters, 'validators')
|
||||
}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
@ -1,11 +1,21 @@
|
||||
<?php if ($errors): ?>
|
||||
<ul>
|
||||
<?php foreach ($errors as $error): ?>
|
||||
<li><?php echo $view['translator']->trans(
|
||||
$error->getMessageTemplate(),
|
||||
$error->getMessageParameters(),
|
||||
'validators'
|
||||
) ?></li>
|
||||
<li><?php
|
||||
if (null === $error->getMessagePluralization()) {
|
||||
echo $view['translator']->trans(
|
||||
$error->getMessageTemplate(),
|
||||
$error->getMessageParameters(),
|
||||
'validators'
|
||||
);
|
||||
} else {
|
||||
echo $view['translator']->transChoice(
|
||||
$error->getMessageTemplate(),
|
||||
$error->getMessagePluralization(),
|
||||
$error->getMessageParameters(),
|
||||
'validators'
|
||||
);
|
||||
}?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
|
Reference in New Issue
Block a user