1

Currently I am developing an app. My user registration uses the recaptcha plugin. When the Captcha is wrong, the app gets the error:

  • incorrect-captcha-sol

How can I translate this message with I18n.t?

pjmorse
  • 9,204
  • 9
  • 54
  • 124
bulleric
  • 2,077
  • 6
  • 21
  • 36

2 Answers2

1

Hm

I found a solution to translate this message n the Recaptcha documentation page.

The verify_recaptcha method provide the :message option but this does not worked for me.

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

I overwrite the flash message. (thx to slobodan)

respond_to do |format|
 if verify_recaptcha
  # ...
 else
   flash[:recaptcha_error] = I18n.t("defaults.recaptcha")
   # ...
 end
end
Community
  • 1
  • 1
bulleric
  • 2,077
  • 6
  • 21
  • 36
1

Recaptcha v0.3.4 does not translate the error: https://github.com/ambethia/recaptcha/blob/043cec2b64646ec270f2b30cfc55da661145e3ae/lib/recaptcha/verify.rb

This is fixed in the master branch.

moiristo
  • 11
  • 1