Include default validation I18n messages (en, zh-CN, zh-TW).

This commit is contained in:
Jason Lee 2015-10-26 15:50:54 +08:00
parent e7ac2bb9ad
commit 7c672bbc92
6 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,8 @@
0.0.1
-----
- Include default validation I18n messages (en, zh-CN, zh-TW).
0.1.0 0.1.0
----- -----

View File

@ -0,0 +1,3 @@
en:
rucaptcha:
invalid: "Captcha invalid!"

View File

@ -0,0 +1,3 @@
'zh-CN':
rucaptcha:
invalid: "驗證碼不正確"

View File

@ -0,0 +1,3 @@
'zh-CN':
rucaptcha:
invalid: "验证码不正确"

View File

@ -14,7 +14,7 @@ module RuCaptcha
def verify_rucaptcha?(resource = nil) def verify_rucaptcha?(resource = nil)
right = params[:_rucaptcha].strip == session[:_rucaptcha] right = params[:_rucaptcha].strip == session[:_rucaptcha]
if resource && resource.respond_to?(:errors) if resource && resource.respond_to?(:errors)
resource.errors.add('rucaptcha', 'invalid') unless right resource.errors.add(:base, t('rucaptcha.invalid')) unless right
end end
right right
end end

View File

@ -1,4 +1,4 @@
module RuCaptcha module RuCaptcha
VERSION = '0.1.0' VERSION = '0.1.1'
end end