diff --git a/recaptcha.module b/recaptcha.module index 65e1ed4..71837a9 100644 --- a/recaptcha.module +++ b/recaptcha.module @@ -108,19 +108,19 @@ function recaptcha_captcha() { '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. https://developers.google.com/recaptcha/docs/customization#i18n + $recaptcha_options['lang'] = drupal_substr($language->language, 0, 2); + } + // Construct the Javascript, but only display it once. static $_recaptcha_jsadded = FALSE; if ($_recaptcha_jsadded == FALSE && $recaptcha_ajax_api == FALSE) { $_recaptcha_jsadded = TRUE; - // Localization support. - global $language; - if (isset($language->language)) { - // reCAPTCHA uses two-character language codes, so 'pt-br' must be - // passed as 'pt'; cf. https://developers.google.com/recaptcha/docs/customization#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';