Project:reCAPTCHA
Version:7.x-1.7
Component:General
Category:feature request
Priority:critical
Assigned:Rob Loach
Status:closed (works as designed)

Issue Summary

This is a small patch that adds support for i18n translated content.

It simply checks if the translation module is loaded and then adds the current language code to the reCAPTCHA inline Javascript. reCAPTCHA only supports 8 languages, though (see here).

AttachmentSize
recaptcha.patch632 bytes

Comments

#1

Here's also a patch for Drupal 6, which doesn't depend on the i18n module for translations anymore.

AttachmentSize
recaptcha.patch 598 bytes

#2

Sorry forgot to add a check to test if Drupal 6 localization is enabled. Patch updated:

AttachmentSize
recaptcha.patch 657 bytes

#3

Version:5.x-2.5» 5.x-2.x-dev
Assigned to:Anonymous» Rob Loach
Status:needs review» reviewed & tested by the community

Very nice! I'll have a look at committing this on Monday.

#4

Why not just:

// add language support
global $language;
$js .= ", lang:'".$language->language."'";

I've double checked it — it works (drupal 6.8).
It's a way better solution (most people don't use i18n module).

Oh, sorry, it was already posted there
http://drupal.org/node/360165

#5

Status:reviewed & tested by the community» needs work

Committed to both Drupal 6 branch and Drupal 5 branches..... Mind testing it in 5.x-2.x-dev and 6.x-1.x-dev before I make the release?

#6

I think the checking is not nesessary

Just do the

$js .= ", lang:'" . $language->language . "'";

It'll work not only for i18 module.

#7

The global $language is new to Drupal 6, so we'll still have to check in Drupal 5. Is 5.x-1.x-dev and 6.x-1.x-dev good with you guys?

#8

Actually, this doesn't work, because reCAPTCHA requires two-character language codes, and Drupal allows postfixing a region, such as "pt-br". I'm posting an improved patch for 6.x-1.1. I suspect a similar fix is required for D5 but I didn't test that.

For now the reCAPTCHA folks just handle eight languages. For further support or better regional translations, we'll need the patch at #398362: Allow custom translation (although it looks like it needs some work). But I think this patch should go in regardless.

AttachmentSize
356348.patch 737 bytes

#9

Priority:normal» critical
Status:needs work» needs review

Whoops, forgot this in the 1.2 release. Is this patch still okay?

#10

Version:5.x-2.x-dev» 6.x-1.2

We still need the call to substr() which is missing in 1.2. I don't know how $language gets set for sites not using locale.module, so I put this back into an if() block.

Here's a new patch rolled against 1.2. Sorry for forgetting to update the issue version with my last patch.

AttachmentSize
356348.patch 680 bytes

#11

Status:needs review» fixed

Thanks! http://drupal.org/cvs?commit=226020

#12

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#13

Version:6.x-1.2» 7.x-1.7

D7 port?

#14

Status:closed (fixed)» active

#15

Status:active» closed (works as designed)

#1177498: Support for custom localization

nobody click here