diff --git a/extensions/tags/src/Listener/SaveTagsToDatabase.php b/extensions/tags/src/Listener/SaveTagsToDatabase.php index c6d04c4c52..c648a3de6a 100755 --- a/extensions/tags/src/Listener/SaveTagsToDatabase.php +++ b/extensions/tags/src/Listener/SaveTagsToDatabase.php @@ -134,11 +134,16 @@ protected function validateTagCount($type, $count) $max = $this->settings->get('flarum-tags.max_'.$type.'_tags'); $key = 'tag_count_'.$type; + /** @var \Illuminate\Validation\Validator $validator */ $validator = $this->validator->make( [$key => $count], [$key => ['numeric', $min === $max ? "size:$min" : "between:$min,$max"]] ); + $validator->setAttributeNames([ + $key => $this->translator->trans("flarum-tags.validation.attributes.$key"), + ]); + if ($validator->fails()) { throw new ValidationException([], ['tags' => $validator->getMessageBag()->first($key)]); }