Skip to content

Commit

Permalink
Translate messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Jul 29, 2022
1 parent 2e45745 commit d520fbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/FormElement/MultiSelectElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function validate()
$option = $this->getOption($value);
if (! $option || $option->getAttributes()->has('disabled')) {
$this->valid = false;
$this->addMessage("'$value' is not allowed here");
$this->addMessage(sprintf($this->translate("'%s' is not allowed here"), $value));

return $this;
}
Expand Down
7 changes: 5 additions & 2 deletions src/FormElement/SelectElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
namespace ipl\Html\FormElement;

use ipl\Html\Html;
use ipl\I18n\Translation;

class SelectElement extends BaseFormElement
{
use Translation;

protected $tag = 'select';

/** @var SelectOption[] */
Expand Down Expand Up @@ -45,7 +48,7 @@ public function validate()
)
) {
$this->valid = false;
$this->addMessage("'$value' is not allowed here");
$this->addMessage(sprintf($this->translate("'%s' is not allowed here"), $value));
} elseif ($this->isRequired() && $value === null) {
$this->valid = false;
} else {
Expand All @@ -69,7 +72,7 @@ public function disableOption($value)
}
if ($this->isSelectedOption($value)) {
$this->valid = false;
$this->addMessage("'$value' is not allowed here");
$this->addMessage(sprintf($this->translate("'%s' is not allowed here"), $value));
}

return $this;
Expand Down

0 comments on commit d520fbf

Please sign in to comment.