--- recaptcha.module 2009-02-02 23:39:42.000000000 +0100 +++ recaptcha_custom.module 2009-03-11 13:41:59.028433100 +0100 @@ -114,6 +114,73 @@ function recaptcha_admin_settings() { '#default_value' => variable_get('recaptcha_tabindex', ''), '#size' => 4, ); + $form['recaptcha_custom_translations'] = array( + '#type' => 'fieldset', + '#title' => t('Custom Translations'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + $form['recaptcha_custom_translations']['recaptcha_use_custom_translations'] = array( + '#type' => 'checkbox', + '#title' => t('Use custom translations'), + '#default_value' => variable_get('recaptcha_use_custom_translations', FALSE), + '#description' => t("If there is no translation for your language, or you want to change the wording of some texts, you can set up custom strings with this option. ") + ); + $form['recaptcha_custom_translations']['recaptcha_visual_challenge'] = array( + '#type' => 'textfield', + '#title' => t('Visual challenge'), + '#default_value' => variable_get('recaptcha_visual_challenge', 'Get a visual challenge'), + '#size' => 50, + ); + $form['recaptcha_custom_translations']['recaptcha_audio_challenge'] = array( + '#type' => 'textfield', + '#title' => t('Audio challenge'), + '#default_value' => variable_get('recaptcha_audio_challenge', 'Get an audio challenge'), + '#size' => 50, + ); + $form['recaptcha_custom_translations']['recaptcha_refresh_btn'] = array( + '#type' => 'textfield', + '#title' => t('Refresh button'), + '#default_value' => variable_get('recaptcha_refresh_btn', 'Get a new challenge'), + '#size' => 50, + ); + $form['recaptcha_custom_translations']['recaptcha_instructions_visual'] = array( + '#type' => 'textfield', + '#title' => t('Instructions visual'), + '#default_value' => variable_get('recaptcha_instructions_visual', 'Type the two words:'), + '#size' => 50, + ); + $form['recaptcha_custom_translations']['recaptcha_instructions_audio'] = array( + '#type' => 'textfield', + '#title' => t('Instructions audio'), + '#default_value' => variable_get('recaptcha_instructions_audio', 'Type what you hear:'), + '#size' => 50, + ); + $form['recaptcha_custom_translations']['recaptcha_help_btn'] = array( + '#type' => 'textfield', + '#title' => t('Help button'), + '#default_value' => variable_get('recaptcha_help_btn', 'Help'), + '#size' => 50, + ); + $form['recaptcha_custom_translations']['recaptcha_play_again'] = array( + '#type' => 'textfield', + '#title' => t('Play again'), + '#default_value' => variable_get('recaptcha_play_again', 'Play sound again'), + '#size' => 50, + ); + $form['recaptcha_custom_translations']['recaptcha_cant_hear_this'] = array( + '#type' => 'textfield', + '#title' => t("Can't hear this"), + '#default_value' => variable_get('recaptcha_cant_hear_this', 'Download sound as MP3'), + '#size' => 50, + ); + $form['recaptcha_custom_translations']['recaptcha_incorrect_try_again'] = array( + '#type' => 'textfield', + '#title' => t('Incorrect. Try again.'), + '#default_value' => variable_get('recaptcha_incorrect_try_again', 'Incorrect. Try again.'), + '#size' => 50, + ); + return system_settings_form($form); } // function recaptcha_admin_settings @@ -159,6 +226,16 @@ function recaptcha_captcha() { $recaptcha_tabindex = variable_get('recaptcha_tabindex', NULL); $recaptcha_public_key = variable_get('recaptcha_public_key', ''); $recaptcha_form_value = NULL; + $recaptcha_use_custom_translations = variable_get('recaptcha_use_custom_translations', 0); + $recaptcha_visual_challenge = variable_get('recaptcha_visual_challenge', ''); + $recaptcha_audio_challenge = variable_get('recaptcha_audio_challenge', ''); + $recaptcha_refresh_btn = variable_get('recaptcha_refresh_btn', ''); + $recaptcha_instructions_visual = variable_get('recaptcha_instructions_visual', ''); + $recaptcha_instructions_audio = variable_get('recaptcha_instructions_audio', ''); + $recaptcha_help_btn = variable_get('recaptcha_help_btn', ''); + $recaptcha_play_again = variable_get('recaptcha_play_again', ''); + $recaptcha_cant_hear_this = variable_get('recaptcha_cant_hear_this', ''); + $recaptcha_incorrect_try_again = variable_get('recaptcha_incorrect_try_again', ''); // Construct the Javascript if (!isset($_recaptcha_jsadded)) { // only display the javascript once. @@ -168,6 +245,22 @@ function recaptcha_captcha() { // Localization support. global $language; $js .= ", lang:'" . $language->language . "'"; + + // Custom Translations + if ($recaptcha_use_custom_translations) + { + $js .= ", custom_translations: {"; + $js .= "visual_challenge : '" . $recaptcha_visual_challenge . "'"; + $js .= ", audio_challenge : '" . $recaptcha_audio_challenge . "'"; + $js .= ", refresh_btn : '" . $recaptcha_refresh_btn . "'"; + $js .= ", instructions_visual : '" . $recaptcha_instructions_visual . "'"; + $js .= ", instructions_audio : '" . $recaptcha_instructions_audio . "'"; + $js .= ", help_btn : '" . $recaptcha_help_btn . "'"; + $js .= ", play_again : '" . $recaptcha_play_again . "'"; + $js .= ", cant_hear_this : '" . $recaptcha_cant_hear_this . "'"; + $js .= ", incorrect_try_again : '" . $recaptcha_incorrect_try_again . "'"; + $js .= "}"; + } // Add support to display the custom theme if ($recaptcha_theme == 'custom') {