From 1d46a1bec92a2eb44997db621a9346e622dd60d4 Mon, 30 Apr 2012 21:09:32 +0200 From: hass Date: Mon, 30 Apr 2012 21:09:11 +0200 Subject: [PATCH] Translatable string review, context sensitive bugfixes diff --git a/captcha.admin.inc b/captcha.admin.inc index 2c257e0..d8941f7 100644 --- a/captcha.admin.inc +++ b/captcha.admin.inc @@ -18,8 +18,8 @@ function _captcha_available_challenge_types($add_special_options=TRUE) { $captcha_types = array(); if ($add_special_options) { - $captcha_types['none'] = '[' . t('none') . ']'; - $captcha_types['default'] = '[' . t('default challenge type') . ']'; + $captcha_types['none'] = t('- None -'); + $captcha_types['default'] = t('Default challenge type'); } // We do our own version of Drupal's module_invoke_all() here because // we want to build an array with custom keys and values. @@ -27,7 +27,7 @@ $result = call_user_func_array($module . '_captcha', array('list')); if (is_array($result)) { foreach ($result as $type) { - $captcha_types["$module/$type"] = t('@type (from module @module)', array('@type' => $type, '@module' => $module)); + $captcha_types["$module/$type"] = t('@type (from module @module)', array('@type' => t($type), '@module' => $module)); } } } @@ -47,9 +47,7 @@ $form['captcha_form_protection'] = array( '#type' => 'fieldset', '#title' => t('Form protection'), - '#description' => t('Select the challenge type you want for each of the listed forms (identified by their so called form_id\'s). You can easily add arbitrary forms with textfield at the bottom of the table or with the help of the \'%CAPTCHA_admin_links\' option below.', - array('%CAPTCHA_admin_links' => t('Add CAPTCHA administration links to forms')) - ), + '#description' => t("Select the challenge type you want for each of the listed forms (identified by their so called form_id's). You can easily add arbitrary forms with the textfield at the bottom of the table or with the help of the Add CAPTCHA administration links to forms below."), ); $form['captcha_form_protection']['captcha_default_challenge'] = array( '#type' => 'select', @@ -113,14 +111,14 @@ '#type' => 'checkbox', '#title' => t('Add CAPTCHA administration links to forms'), '#default_value' => variable_get('captcha_administration_mode', FALSE), - '#description' => t('This option makes it easy to manage CAPTCHA settings on forms. When enabled, users with the "%admincaptcha" permission will see a fieldset with CAPTCHA administration links on all forms, except on administrative pages.', array('%admincaptcha' => t('administer CAPTCHA settings'))), + '#description' => t('This option makes it easy to manage CAPTCHA settings on forms. When enabled, users with the administer CAPTCHA settings permission will see a fieldset with CAPTCHA administration links on all forms, except on administrative pages.'), ); // Field for the CAPTCHAs on admin pages. $form['captcha_form_protection']['captcha_allow_on_admin_pages'] = array( '#type' => 'checkbox', '#title' => t('Allow CAPTCHAs and CAPTCHA administration links on administrative pages'), '#default_value' => variable_get('captcha_allow_on_admin_pages', FALSE), - '#description' => t('This option makes it possible to add CAPTCHAs to forms on administrative pages. CAPTCHAs are disabled by default on administrative pages (which shouldn\'t be accessible to untrusted users normally) to avoid the related overhead. In some situations, e.g. in the case of demo sites, it can be usefull to allow CAPTCHAs on administrative pages.'), + '#description' => t("This option makes it possible to add CAPTCHAs to forms on administrative pages. CAPTCHAs are disabled by default on administrative pages (which shouldn't be accessible to untrusted users normally) to avoid the related overhead. In some situations, e.g. in the case of demo sites, it can be usefull to allow CAPTCHAs on administrative pages."), ); // Button for flushing the CAPTCHA placement cache. @@ -132,7 +130,7 @@ ); $form['captcha_form_protection']['captcha_placement_caching']['captcha_placement_cache_flush'] = array( '#type' => 'submit', - '#value' => t('Flush the CAPTCHA placement cache'), + '#value' => t('Clear the CAPTCHA placement cache'), '#submit' => array('captcha_flush_captcha_placement_cache_submit'), ); @@ -149,7 +147,7 @@ $form['captcha_descriptions'] = array( '#type' => 'fieldset', '#title' => t('CAPTCHA description'), - '#description' => t('Configurable description of the CAPTCHA. An empty entry will reset the description.'), + '#description' => t('Configurable description of the CAPTCHA. An empty entry will reset the description to default.'), '#attributes' => array('id' => 'edit-captcha-description-wrapper'), ); foreach ($langs as $lang_code => $lang_name) { @@ -165,7 +163,7 @@ $form['captcha_description'] = array( '#type' => 'textfield', '#title' => t('Challenge description'), - '#description' => t('Configurable description of the CAPTCHA. An empty entry will reset the description.'), + '#description' => t('Configurable description of the CAPTCHA. An empty entry will reset the description to default.'), '#default_value' => _captcha_get_description(), '#maxlength' => 256, '#attributes' => array('id' => 'edit-captcha-description-wrapper'), @@ -313,7 +311,7 @@ variable_set('captcha_persistence', $form_state['values']['captcha_persistence']); variable_set('captcha_log_wrong_responses', $form_state['values']['captcha_log_wrong_responses']); - drupal_set_message(t('The CAPTCHA settings were saved.'), 'status'); + drupal_set_message(t('The CAPTCHA settings have been saved.'), 'status'); } @@ -324,7 +322,7 @@ */ function captcha_flush_captcha_placement_cache_submit($form, &$form_state) { variable_del('captcha_placement_map_cache'); - drupal_set_message(t('Flushed the CAPTCHA placement cache.')); + drupal_set_message(t('Cleared the CAPTCHA placement cache.')); } @@ -378,7 +376,7 @@ $form['captcha_type'] = array( '#type' => 'select', '#title' => t('Challenge type'), - '#description' => t('The CAPTCHA type to use for this form'), + '#description' => t('The CAPTCHA type to use for this form.'), '#default_value' => $default_captcha_type, '#options' => _captcha_available_challenge_types(), ); @@ -495,10 +493,10 @@ foreach ($challenges as $ckey => $challenge) { $form["captcha_{$mkey}_{$ckey}"] = array( '#type' => 'fieldset', - '#title' => t('Challenge "%challenge" by module "%module"', array('%challenge' => $challenge, '%module' => $module)), + '#title' => t('Challenge %challenge by module %module', array('%challenge' => $challenge, '%module' => $module)), 'challenge' => _captcha_generate_example_challenge($module, $challenge), 'more_examples' => array( - '#markup' => l(t('10 more examples of this challenge.'), "admin/config/people/captcha/captcha/examples/$module/$challenge"), + '#markup' => l(t('10 more examples of this challenge.'), "admin/config/people/captcha/captcha/examples/$module/$challenge"), ), ); } diff --git a/captcha.inc b/captcha.inc index e8212b1..ca9cad8 100644 --- a/captcha.inc +++ b/captcha.inc @@ -52,8 +52,8 @@ ->execute(); } else { - drupal_set_message(t('Failed to set a CAPTCHA type for form %form_id: could not interpret value "@captcha_type"', - array('%form_id' => $form_id, '@captcha_type' => (string)$captcha_type)), 'warning'); + drupal_set_message(t('Failed to set a CAPTCHA type for form %form_id: could not interpret value %captcha_type.', + array('%form_id' => $form_id, '%captcha_type' => (string)$captcha_type)), 'warning'); } } diff --git a/captcha.module b/captcha.module index 8e3f05d..d95264d 100644 --- a/captcha.module +++ b/captcha.module @@ -39,11 +39,9 @@ switch ($path) { case 'admin/help#captcha': $output = '

' . t('"CAPTCHA" is an acronym for "Completely Automated Public Turing test to tell Computers and Humans Apart". It is typically a challenge-response test to determine whether the user is human. The CAPTCHA module is a tool to fight automated submission by malicious users (spamming) of for example comments forms, user registration forms, guestbook forms, etc. You can extend the desired forms with an additional challenge, which should be easy for a human to solve correctly, but hard enough to keep automated scripts and spam bots out.') . '

'; - $output .= '

' . t('Note that the CAPTCHA module interacts with page caching (see performance settings). Because the challenge should be unique for each generated form, the caching of the page it appears on is prevented. Make sure that these forms do not appear on too many pages or you will lose much caching efficiency. For example, if you put a CAPTCHA on the user login block, which typically appears on each page for anonymous visitors, caching will practically be disabled. The comment submission forms are another example. In this case you should set the "%commentlocation" to "%separatepage" in the comment settings of the relevant content types for better caching efficiency.' , + $output .= '

' . t('Note that the CAPTCHA module interacts with page caching (see performance settings). Because the challenge should be unique for each generated form, the caching of the page it appears on is prevented. Make sure that these forms do not appear on too many pages or you will lose much caching efficiency. For example, if you put a CAPTCHA on the user login block, which typically appears on each page for anonymous visitors, caching will practically be disabled. The comment submission forms are another example. In this case you should set the Location of comment submission form to Display on separate page in the comment settings of the relevant content types for better caching efficiency.', array( '!performancesettings' => url('admin/settings/performance'), - '%commentlocation' => t('Location of comment submission form'), - '%separatepage' => t('Display on separate page'), '!contenttypes' => url('admin/content/types'), ) ) . '

'; @@ -52,10 +50,8 @@ case 'admin/config/people/captcha': case 'admin/config/people/captcha/captcha': case 'admin/config/people/captcha/captcha/settings': - $output = '

' . t('A CAPTCHA can be added to virtually each Drupal form. Some default forms are already provided in the form list, but arbitrary forms can be easily added and managed when the option "%adminlinks" is enabled.', - array('%adminlinks' => t('Add CAPTCHA administration links to forms'))) . '

'; - $output .= '

' . t('Users with the "%skipcaptcha" permission won\'t be offered a challenge. Be sure to grant this permission to the trusted users (e.g. site administrators). If you want to test a protected form, be sure to do it as a user without the "%skipcaptcha" permission (e.g. as anonymous user).', - array('%skipcaptcha' => t('skip CAPTCHA'), '@perm' => url('admin/user/permissions'))) . '

'; + $output = '

' . t('A CAPTCHA can be added to virtually each Drupal form. Some default forms are already provided in the form list, but arbitrary forms can be easily added and managed when the option Add CAPTCHA administration links to forms is enabled.') . '

'; + $output .= '

' . t('Users with the Skip CAPTCHA permission won\'t be offered a challenge. Be sure to grant this permission to the trusted users (e.g. site administrators). If you want to test a protected form, be sure to do it as a user without the Skip CAPTCHA permission (e.g. as anonymous user).', array('@perm' => url('admin/user/permissions'))) . '

'; return $output; } } @@ -369,17 +365,17 @@ ); if ($captcha_point !== NULL && $captcha_point->captcha_type) { $captcha_element['#title'] = t('CAPTCHA: challenge "@type" enabled', array('@type' => $captcha_point->captcha_type)); - $captcha_element['#description'] = t('Untrusted users will see a CAPTCHA here (!settings).', - array('!settings' => l(t('general CAPTCHA settings'), 'admin/config/people/captcha')) + $captcha_element['#description'] = t('Untrusted users will see a CAPTCHA here (general CAPTCHA settings).', + array('@settings' => url('admin/config/people/captcha')) ); $captcha_element['challenge'] = array( '#type' => 'item', '#title' => t('Enabled challenge'), - '#markup' => t('"@type" by module "@module" (!change, !disable)', array( - '@type' => $captcha_point->captcha_type, - '@module' => $captcha_point->module, - '!change' => l(t('change'), "admin/config/people/captcha/captcha/captcha_point/$form_id", array('query' => drupal_get_destination())), - '!disable' => l(t('disable'), "admin/config/people/captcha/captcha/captcha_point/$form_id/disable", array('query' => drupal_get_destination())), + '#markup' => t('%type by module %module (change, disable)', array( + '%type' => $captcha_point->captcha_type, + '%module' => $captcha_point->module, + '@change' => url("admin/config/people/captcha/captcha/captcha_point/$form_id", array('query' => drupal_get_destination())), + '@disable' => url("admin/config/people/captcha/captcha/captcha_point/$form_id/disable", array('query' => drupal_get_destination())), )), ); // Add an example challenge with solution. @@ -621,7 +617,7 @@ // log to watchdog if needed if (variable_get('captcha_log_wrong_responses', FALSE)) { watchdog('CAPTCHA', - '%form_id post blocked by CAPTCHA module: challenge "%challenge" (by module "%module"), user answered "%response", but the solution was "%solution".', + '%form_id post blocked by CAPTCHA module: challenge %challenge (by module %module), user answered %response, but the solution was %solution.', array('%form_id' => $form_id, '%response' => $captcha_response, '%solution' => $solution, '%challenge' => $captcha_info['captcha_type'], '%module' => $captcha_info['module'], diff --git a/image_captcha/image_captcha.admin.inc b/image_captcha/image_captcha.admin.inc index b3c9f02..18986ae 100644 --- a/image_captcha/image_captcha.admin.inc +++ b/image_captcha/image_captcha.admin.inc @@ -85,15 +85,16 @@ '#maxlength' => 7, '#size' => 8, ); + // "Level:" is a translatable string "context" for the options. $form['image_captcha_color_settings']['image_captcha_foreground_color_randomness'] = array( '#type' => 'select', '#title' => t('Additional variation of text color'), '#options' => array( - 0 => t('none'), - 50 => t('small'), - 100 => t('moderate'), - 150 => t('high'), - 200 => t('very high'), + 0 => t('Level: none'), + 50 => t('Level: small'), + 100 => t('Level: moderate'), + 150 => t('Level: high'), + 200 => t('Level: very high'), ), '#default_value' => (int) variable_get('image_captcha_foreground_color_randomness', 100), '#description' => t('The different characters will have randomized colors in the specified range around the text color.'),