Index: recaptcha.module =================================================================== --- recaptcha.module (revision 154) +++ recaptcha.module (revision 155) @@ -101,6 +101,14 @@ $cache = variable_get('cache', FALSE); $conf['cache'] = $cache; } + // Localization support. + global $language; + if (isset($language->language)) { + // reCAPTCHA uses two-character language codes, so 'pt-br' must be + // passed as 'pt' (cf. http://wiki.recaptcha.net/index.php/I18n). + $recaptcha_options['lang'] = drupal_substr($language->language, 0, 2); + $recaptcha_lang = $recaptcha_options['lang']; + } // Construct the Javascript, but only display it once. static $_recaptcha_jsadded = FALSE; @@ -110,14 +118,6 @@ 'theme' => $recaptcha_theme, ); - // Localization support. - global $language; - if (isset($language->language)) { - // reCAPTCHA uses two-character language codes, so 'pt-br' must be - // passed as 'pt' (cf. http://wiki.recaptcha.net/index.php/I18n). - $recaptcha_options['lang'] = drupal_substr($language->language, 0, 2); - } - // Add support to display the custom theme. if ($recaptcha_theme == 'custom') { $recaptcha_options['custom_theme_widget'] = 'recaptcha_custom_theme_widget'; @@ -153,7 +153,7 @@ '#type' => 'item', '#markup' => '
' . $html . '
', ); - $js = "(function ($) { $(function() { Recaptcha.create('$recaptcha_public_key', 'recaptcha_ajax_api_container', {theme: '$recaptcha_theme'});});})(jQuery);"; + $js = "(function ($) { $(function() { Recaptcha.create('$recaptcha_public_key', 'recaptcha_ajax_api_container', {theme: '$recaptcha_theme',lang: '$recaptcha_lang'});});})(jQuery);"; drupal_add_js('http://api.recaptcha.net/js/recaptcha_ajax.js', array('type' => 'external')); drupal_add_js($js, array('type' => 'inline')); }