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).
[codebox 10] source: https://developers.google.com/recaptcha/docs/customization#i18n.
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:
- open the file recaptchalib.php from the folder in which recaptcha resides.
- find the function recaptcha_get_html
- change [codebox 1] into [codebox 2][adding $language as a parameter to the function]
- 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.
- 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.
- 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.