diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index bd71515..7584a2b 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -62,6 +62,7 @@ Yii Framework 2 Change Log - Bug #3989: Fixed yii\log\FileTarget::$rotateByCopy to avoid any rename (cebe) - Bug #3996: Traversing `Yii::$app->session` may cause a PHP error (qiangxue) - Bug #4020: OCI column detection did not work so gii and other things failed (Sanya1991) +- Bug #4127: `CaptchaValidator` clientside error message wasn't formed properly (samdark) - Bug: Fixed inconsistent return of `\yii\console\Application::runAction()` (samdark) - Bug: URL encoding for the route parameter added to `\yii\web\UrlManager` (klimov-paul) - Bug: Fixed the bug that requesting protected or private action methods would cause 500 error instead of 404 (qiangxue) diff --git a/framework/captcha/CaptchaValidator.php b/framework/captcha/CaptchaValidator.php index 5eb0c55..0ddeb48 100644 --- a/framework/captcha/CaptchaValidator.php +++ b/framework/captcha/CaptchaValidator.php @@ -92,9 +92,9 @@ class CaptchaValidator extends Validator 'hash' => $hash, 'hashKey' => 'yiiCaptcha/' . $this->captchaAction, 'caseSensitive' => $this->caseSensitive, - 'message' => strtr($this->message, [ + 'message' => Yii::$app->getI18n()->format($this->message, [ 'attribute' => $object->getAttributeLabel($attribute), - ]), + ], Yii::$app->language), ]; if ($this->skipOnEmpty) { $options['skipOnEmpty'] = 1;