Feb 24 2012

Howto: WordPress reCaptcha Plugin Localization

The Background

CAPTCHA is a technique where an input (a.k.a. web form) is protected by a picture challenge to prevent bots from writing spam messages to forums, blogs, etc. Google digitizes books and old newspapers using scanners and OCR software to convert the images into text. Sometimes the software cannot interpret the word correctly due to a typo, bad quality in the printing, etc.

reCaptcha

Now reCaptcha is an ingenious invention by Google to combine the two forementioned problems to solve one another. The reCaptcha mechanism presents the problematic unrecognized words to people to be solved. It takes approx. 10 seconds to solve the challenge by a human and millions of them are solved every day. When enough people solve the word similarly it is safe to assume that it means that. But how in the world the system knows if the person has solved it correctly when there are no answers in the beginning? That is another great invention: the person is always presented two words instead of one — the answer to the other is already known. If the person gets it right it is assumed that she can solve the other one too.

Localizing the Plugin

There is a WordPress plugin WP-reCAPTCHA that utilizes the reCaptcha mechanism and protects the commenting and registration forms. According to the reCaptcha documentation it is possible to give the widget language as a parameter as a RecaptchaOption. However I did not manage to get the language changed, no matter what I tried — it was always Finnish. I even considered giving English and Finnish as custom translations because manually overriding worked. It would have been a waste of time because the widget supports natively both languages that I needed. In one forum I read that it automatically chooses the language based on IP Geolocation. In my opinion this is wrong because for example there are many people living in Finland who don’t understand Finnish.

Finally I discovered that the language can be given as an additional parameter, ‘hl’, when fetching the challenge. In the file ‘recaptchalib.php’ (function recaptcha_get_html):

return ‘<script type=”text/javascript” src=”‘. $server . ‘/challenge?k=’ . $pubkey .’&hl=en’. $errorpart . ‘”></script>

2 Responses to “Howto: WordPress reCaptcha Plugin Localization”

  • Martin Says:

    I’m extremely impressed along with your writing skills as neatly as with the format in your blog. Is that this a paid subject or did you modify it your self? Anyway keep up the nice quality writing, it is rare to see a great blog like this one these days..

    My web blog :: carpal tunnel syndrome

  • Shiela Says:

    An interesting discussion is worth comment. There’s no doubt that that you ought to write more about this
    topic, it might not be a taboo matter but generally people
    don’t discuss these topics. To the next! Kind regards!!

    My blog post DaineSSholl

Leave a Reply