Skip to content

Commit

Permalink
DefaultFormRenderer: added error message translation (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
vlastavesely authored and dg committed Mar 29, 2017
1 parent e03e381 commit 1b37eaa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Forms/Rendering/DefaultFormRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ public function renderEnd()
*/
public function renderErrors(Nette\Forms\IControl $control = NULL, $own = TRUE)
{
$translator = $this->form->getTranslator();

$errors = $control
? $control->getErrors()
: ($own ? $this->form->getOwnErrors() : $this->form->getErrors());
Expand All @@ -229,7 +231,7 @@ public function renderErrors(Nette\Forms\IControl $control = NULL, $own = TRUE)
if ($error instanceof IHtmlString) {
$item->addHtml($error);
} else {
$item->setText($error);
$item->setText($translator ? $translator->translate($error) : $error);
}
$container->addHtml($item);
}
Expand Down

0 comments on commit 1b37eaa

Please sign in to comment.