public function clientValidateAttribute($model, $attribute, $view)
{
$label = $model->getAttributeLabel($attribute);
$options = ['message' => Yii::$app->getI18n()->format($this->message, ['attribute' => $label], Yii::$app->language)];
if ($this->min !== null) {
$options['min'] = $this->min;
$options['tooShort'] = Yii::$app->getI18n()->format($this->tooShort, ['attribute' => $label, 'min' => $this->min], Yii::$app->language);
}
if ($this->max !== null) {
$options['max'] = $this->max;
$options['tooLong'] = Yii::$app->getI18n()->format($this->tooLong, ['attribute' => $label, 'max' => $this->max], Yii::$app->language);
}
if ($this->length !== null) {
$options['is'] = $this->length;
$options['notEqual'] = Yii::$app->getI18n()->format($this->notEqual, ['attribute' => $label, 'length' => $this->length], Yii::$app->language);
}
if ($this->skipOnEmpty) {
$options['skipOnEmpty'] = 1;
}
ValidationAsset::register($view);
return 'yii.validation.string(value, messages, ' . json_encode($options, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ');';
}