From 553737dd012f7bcffdd3373ffd2e46aa3ad96f40 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Sun, 15 May 2011 17:39:12 -0700 Subject: [PATCH] =?UTF-8?q?-=20Patch=20#1157426=20by=20G=C3=A1bor=20Hojtsy?= =?UTF-8?q?:=20field=20system=20uses=20t()=20incorrectly=20and=20inconsist?= =?UTF-8?q?ently.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/field/field.default.inc | 4 ++-- modules/field/field.form.inc | 6 +++--- modules/field/modules/list/list.module | 2 +- modules/field/modules/number/number.module | 8 ++++---- modules/field_ui/field_ui.module | 3 +-- modules/taxonomy/taxonomy.module | 2 +- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/modules/field/field.default.inc b/modules/field/field.default.inc index 93b5bea95e22..a10d1387f8cb 100644 --- a/modules/field/field.default.inc +++ b/modules/field/field.default.inc @@ -81,7 +81,7 @@ function field_default_validate($entity_type, $entity, $field, $instance, $langc if ($field['cardinality'] != FIELD_CARDINALITY_UNLIMITED && count($items) > $field['cardinality']) { $errors[$field['field_name']][$langcode][0][] = array( 'error' => 'field_cardinality', - 'message' => t('%name: this field cannot hold more than @count values.', array('%name' => t($instance['label']), '@count' => $field['cardinality'])), + 'message' => t('%name: this field cannot hold more than @count values.', array('%name' => $instance['label'], '@count' => $field['cardinality'])), ); } } @@ -214,7 +214,7 @@ function field_default_view($entity_type, $entity, $field, $instance, $langcode, $info = array( '#theme' => 'field', '#weight' => $display['weight'], - '#title' => t($instance['label']), + '#title' => $instance['label'], '#access' => field_access('view', $field, $entity_type, $entity), '#label_display' => $display['label'], '#view_mode' => $view_mode, diff --git a/modules/field/field.form.inc b/modules/field/field.form.inc index f5782818dbc2..845f04109853 100644 --- a/modules/field/field.form.inc +++ b/modules/field/field.form.inc @@ -69,7 +69,7 @@ function field_default_form($entity_type, $entity, $field, $instance, $langcode, '#language' => $langcode, '#field_parents' => $parents, '#columns' => array_keys($field['columns']), - '#title' => check_plain(t($instance['label'])), + '#title' => check_plain($instance['label']), '#description' => field_filter_xss($instance['description']), // Only the first widget should be required. '#required' => $delta == 0 && $instance['required'], @@ -151,8 +151,8 @@ function field_multiple_value_form($field, $instance, $langcode, $items, &$form, break; } - $title = check_plain(t($instance['label'])); - $description = field_filter_xss(t($instance['description'])); + $title = check_plain($instance['label']); + $description = field_filter_xss($instance['description']); $id_prefix = implode('-', array_merge($parents, array($field_name))); $wrapper_id = drupal_html_id($id_prefix . '-add-more-wrapper'); diff --git a/modules/field/modules/list/list.module b/modules/field/modules/list/list.module index f7ac95172dd7..608679bbb5f9 100644 --- a/modules/field/modules/list/list.module +++ b/modules/field/modules/list/list.module @@ -379,7 +379,7 @@ function list_field_validate($entity_type, $entity, $field, $instance, $langcode if (!empty($allowed_values) && !isset($allowed_values[$item['value']])) { $errors[$field['field_name']][$langcode][$delta][] = array( 'error' => 'list_illegal_value', - 'message' => t('%name: illegal value.', array('%name' => t($instance['label']))), + 'message' => t('%name: illegal value.', array('%name' => $instance['label'])), ); } } diff --git a/modules/field/modules/number/number.module b/modules/field/modules/number/number.module index fe1221cf0fa4..20e380777f64 100644 --- a/modules/field/modules/number/number.module +++ b/modules/field/modules/number/number.module @@ -138,13 +138,13 @@ function number_field_validate($entity_type, $entity, $field, $instance, $langco if (is_numeric($instance['settings']['min']) && $item['value'] < $instance['settings']['min']) { $errors[$field['field_name']][$langcode][$delta][] = array( 'error' => 'number_min', - 'message' => t('%name: the value may be no less than %min.', array('%name' => t($instance['label']), '%min' => $instance['settings']['min'])), + 'message' => t('%name: the value may be no less than %min.', array('%name' => $instance['label'], '%min' => $instance['settings']['min'])), ); } if (is_numeric($instance['settings']['max']) && $item['value'] > $instance['settings']['max']) { $errors[$field['field_name']][$langcode][$delta][] = array( 'error' => 'number_max', - 'message' => t('%name: the value may be no greater than %max.', array('%name' => t($instance['label']), '%max' => $instance['settings']['max'])), + 'message' => t('%name: the value may be no greater than %max.', array('%name' => $instance['label'], '%max' => $instance['settings']['max'])), ); } } @@ -367,12 +367,12 @@ function number_field_widget_validate($element, &$form_state) { case 'float': case 'decimal': $regexp = '@[^-0-9\\' . $field['settings']['decimal_separator'] . ']@'; - $message = t('Only numbers and the decimal separator (@separator) allowed in %field.', array('%field' => t($instance['label']), '@separator' => $field['settings']['decimal_separator'])); + $message = t('Only numbers and the decimal separator (@separator) allowed in %field.', array('%field' => $instance['label'], '@separator' => $field['settings']['decimal_separator'])); break; case 'integer': $regexp = '@[^-0-9]@'; - $message = t('Only numbers are allowed in %field.', array('%field' => t($instance['label']))); + $message = t('Only numbers are allowed in %field.', array('%field' => $instance['label'])); break; } if ($value != preg_replace($regexp, '', $value)) { diff --git a/modules/field_ui/field_ui.module b/modules/field_ui/field_ui.module index 28ac0e1d351d..b828fff2c8c9 100644 --- a/modules/field_ui/field_ui.module +++ b/modules/field_ui/field_ui.module @@ -227,7 +227,7 @@ function field_ui_menu_load($field_name, $entity_type, $bundle_name, $bundle_pos * Menu title callback. */ function field_ui_menu_title($instance) { - return t($instance['label']); + return $instance['label']; } /** @@ -356,4 +356,3 @@ function field_ui_form_node_type_form_submit($form, &$form_state) { $form_state['redirect'] = _field_ui_bundle_admin_path('node', $form_state['values']['type']) .'/fields'; } } - diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 71f3edbd9166..50d2fd608340 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -1316,7 +1316,7 @@ function taxonomy_field_validate($entity_type, $entity, $field, $instance, $lang if (!$validate) { $errors[$field['field_name']][$langcode][$delta][] = array( 'error' => 'taxonomy_term_reference_illegal_value', - 'message' => t('%name: illegal value.', array('%name' => t($instance['label']))), + 'message' => t('%name: illegal value.', array('%name' => $instance['label'])), ); } } -- GitLab