Aug 152012

i was trying to customize recaptcha 1.11 so that it would show instructions in a language different than english (mind you, showing words to recognize in different languages appears not be available yet, this post only concerns the language of the instruction).
according to this instruction this can be achieved by inserting a javascript snippet before the form in which the recaptcha appears:
[codebox 10] source:

this does not work, however. this is especially annoying if you have dynamic language content on your original page and want to administer different languages (also through to the recaptcha widget) depending on user settings. but here’s a work around until this gets fixed:

  1. open the file recaptchalib.php from the folder in which recaptcha resides.
  2. find the function recaptcha_get_html
  3. change [codebox 1] into [codebox 2][adding $language as a parameter to the function]
  4. add this: [codebox 3] as the first statement in the function, so that the whole thing looks like this:[codebox 4]
    this bit ensures that you can pass a language parameter to the function, but if this language parameter is anything other then the languages available at this time (dutch=nl, french=fr, german=de, portuguese=pt, russian=ru, spanish=es, turkish=tr), then english will be chosen.
  5. then find, still within the function recaptcha_get_html, this line: [codebox 5] and change it to [codebox 6]. also change this line: [codebox 7] into [codebox 8] still within the same function.

note that the requests to the recaptcha api now submit the extra parameter hl with the value of the language you want.

  1. now, within your original script, instead of using the original function recaptcha_get_html with only one parameter ($publickey) you would insert [codebox 9] which calls the function you edited above with the extra parameter of the language. $lang_pass is in this case the language parameter you get from somewhere else in the script.

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.