翻译Recaptcha错误消息的正确翻译标签是什么

时间:2012-04-12 09:32:10

标签: ruby-on-rails recaptcha i18n-gem

目前我正在开发一款应用。我的用户注册使用了recaptcha插件。 当Captcha错误时,应用程序会收到错误:

  • 不正确-验证码溶胶

如何使用I18n.t翻译此邮件?

2 个答案:

答案 0 :(得分:1)

我找到了翻译此邮件的解决方案 在Recaptcha文档页面。

verify_recaptcha方法提供:message选项 但这对我没有用。

respond_to do |format|
  if verify_recaptcha(:model => @post, :message => 'Oh! It's error with reCAPTCHA!') && @post.save
  # ...
   else
  # ...
  end
end

我覆盖了flash消息。 (thx to slobodan

respond_to do |format|
 if verify_recaptcha
  # ...
 else
   flash[:recaptcha_error] = I18n.t("defaults.recaptcha")
   # ...
 end
end

答案 1 :(得分:1)