diff --git a/CHANGELOG.md b/CHANGELOG.md index 502ca89..d32489a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +0.0.1 +----- + +- Include default validation I18n messages (en, zh-CN, zh-TW). + 0.1.0 ----- diff --git a/config/locales/rucaptcha.en.yml b/config/locales/rucaptcha.en.yml new file mode 100644 index 0000000..1169adc --- /dev/null +++ b/config/locales/rucaptcha.en.yml @@ -0,0 +1,3 @@ +en: + rucaptcha: + invalid: "Captcha invalid!" diff --git a/config/locales/rucaptcha.zh-CN.yml b/config/locales/rucaptcha.zh-CN.yml new file mode 100644 index 0000000..44f3061 --- /dev/null +++ b/config/locales/rucaptcha.zh-CN.yml @@ -0,0 +1,3 @@ +'zh-CN': + rucaptcha: + invalid: "驗證碼不正確" diff --git a/config/locales/rucaptcha.zh-TW.yml b/config/locales/rucaptcha.zh-TW.yml new file mode 100644 index 0000000..cc615da --- /dev/null +++ b/config/locales/rucaptcha.zh-TW.yml @@ -0,0 +1,3 @@ +'zh-CN': + rucaptcha: + invalid: "验证码不正确" diff --git a/lib/rucaptcha/controller_helpers.rb b/lib/rucaptcha/controller_helpers.rb index b44444b..489ee79 100644 --- a/lib/rucaptcha/controller_helpers.rb +++ b/lib/rucaptcha/controller_helpers.rb @@ -14,7 +14,7 @@ module RuCaptcha def verify_rucaptcha?(resource = nil) right = params[:_rucaptcha].strip == session[:_rucaptcha] if resource && resource.respond_to?(:errors) - resource.errors.add('rucaptcha', 'invalid') unless right + resource.errors.add(:base, t('rucaptcha.invalid')) unless right end right end diff --git a/lib/rucaptcha/version.rb b/lib/rucaptcha/version.rb index 3c4f9ff..7981c66 100644 --- a/lib/rucaptcha/version.rb +++ b/lib/rucaptcha/version.rb @@ -1,4 +1,4 @@ module RuCaptcha - VERSION = '0.1.0' + VERSION = '0.1.1' end