#7 new
martoche

Support for I18n

Reported by martoche | November 19th, 2008 @ 01:52 PM

The error "Captcha response is incorrect, please try again." is hardcoded in English. It would be great is the plugin looked for a translation using the internationalization system in Rails 2.2+.

Martin

Comments and changes to this ticket

  • Jason L Perry

    Jason L Perry November 20th, 2008 @ 03:24 AM

    Hmm, yes, great idea. I've got a ton of patches to sift through, I'm gonna try to set aside some time this week to take care of them. I'll definitely work on this one too.

  • Roman Shterenzon

    Roman Shterenzon January 18th, 2009 @ 01:27 PM

    • Tag set to i18n, patch

    Please find attached a patch which adds I18n support.

    By the way, the latest changes introduced to the recaptcha rendered the rdoc incorrect. It's impossible to use verify_recaptcha(@model) now, you have rather use verify_recaptcha(:model => @model). I wasted some time in order to understand, why I'm not getting any errors in my model. The simple fix can be adding

    
    @@ -51,6 +51,7 @@ module Ambethia
           # variable +RECAPTCHA_PUBLIC_KEY+.
           def verify_recaptcha(options = {})
             return true if SKIP_VERIFY_ENV.include? ENV['RAILS_ENV']
    +        model = options if options.is_a? ActiveRecord::Base
             private_key = options[:private_key] ||= ENV['RECAPTCHA_PRIVATE_KEY']
             raise ReCaptchaError, "No private key specified." unless private_key
             begin
    
  • Roman Shterenzon

    Roman Shterenzon January 18th, 2009 @ 01:29 PM

    Hmm.. no, sorry, the line "if model = options[:model]" should be changed as well.

  • Roman Shterenzon

    Roman Shterenzon January 18th, 2009 @ 01:37 PM

    I came up with the following, seems to work for both the old and the new way of specifying the model.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

A rails plugin that adds helpers for the ReCAPTCHA API.

People watching this ticket

Attachments

Tags

Pages