From 8f30303fae4856e5efe1ad4de0d5a9fd9fb78b3a Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Wed, 31 Aug 2016 16:12:18 +0900 Subject: [PATCH 1/2] fix the error message used by MemberConfigForm::isUnique() couldn't handle a token for i18n correctly (fixes #4000) --- i18n/messages.ja.xml | 4 ++-- lib/form/doctrine/MemberConfigForm.class.php | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/i18n/messages.ja.xml b/i18n/messages.ja.xml index 24f46327f..fdd144581 100644 --- a/i18n/messages.ja.xml +++ b/i18n/messages.ja.xml @@ -83,8 +83,8 @@ 上に表示されているキーワードを入力してください。 - Invalid mobile_address. - メールアドレスが無効です。 + Invalid %name%. + 不正な %name% です。 Mon diff --git a/lib/form/doctrine/MemberConfigForm.class.php b/lib/form/doctrine/MemberConfigForm.class.php index a3546a585..969b5ba30 100644 --- a/lib/form/doctrine/MemberConfigForm.class.php +++ b/lib/form/doctrine/MemberConfigForm.class.php @@ -125,6 +125,8 @@ public function setMemberConfigWidget($name) 'empty_value' => $this->validatorSchema[$name]->getOption('empty_value'), )); + $uniqueValidator->addMessage('duplicate', 'Invalid %name%.'); + $this->validatorSchema[$name] = new sfValidatorAnd(array( $this->validatorSchema[$name], $uniqueValidator, @@ -229,7 +231,7 @@ public function isUnique($validator, $value, $arguments = array()) return $value; } - throw new sfValidatorError($validator, 'Invalid %name%.', array('name' => $name)); + throw new sfValidatorError($validator, 'duplicate', array('name' => $name)); } public function isValid() From ceb40601953e941f693cc1e725103a24cd324f91 Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Wed, 31 Aug 2016 16:29:54 +0900 Subject: [PATCH 2/2] unifying the message text for IsUnique error used by MemberConfigForm and MemberProfileForm (fixes #3999) --- i18n/messages.ja.xml | 4 ---- lib/form/doctrine/MemberConfigForm.class.php | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/i18n/messages.ja.xml b/i18n/messages.ja.xml index fdd144581..c7b0096ca 100644 --- a/i18n/messages.ja.xml +++ b/i18n/messages.ja.xml @@ -82,10 +82,6 @@ Please input the below keyword. 上に表示されているキーワードを入力してください。 - - Invalid %name%. - 不正な %name% です。 - Mon diff --git a/lib/form/doctrine/MemberConfigForm.class.php b/lib/form/doctrine/MemberConfigForm.class.php index 969b5ba30..87cc6434a 100644 --- a/lib/form/doctrine/MemberConfigForm.class.php +++ b/lib/form/doctrine/MemberConfigForm.class.php @@ -125,7 +125,7 @@ public function setMemberConfigWidget($name) 'empty_value' => $this->validatorSchema[$name]->getOption('empty_value'), )); - $uniqueValidator->addMessage('duplicate', 'Invalid %name%.'); + $uniqueValidator->addMessage('duplicate', 'The inputted value is already exist.'); $this->validatorSchema[$name] = new sfValidatorAnd(array( $this->validatorSchema[$name], @@ -231,7 +231,7 @@ public function isUnique($validator, $value, $arguments = array()) return $value; } - throw new sfValidatorError($validator, 'duplicate', array('name' => $name)); + throw new sfValidatorError($validator, 'duplicate'); } public function isValid()