Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #18483 -- Marked hidden field error string for translation

Thanks Evil Clay for the report and Emil Stenstrom for the initial
patch.
  • Loading branch information...
commit 962f133f72abe2a1174d48baa52aa8549762a022 1 parent 6605ac3
Claude Paroz authored January 26, 2013

Showing 1 changed file with 6 additions and 2 deletions. Show diff stats Hide diff stats

  1. 8  django/forms/forms.py
8  django/forms/forms.py
@@ -14,6 +14,7 @@
14 14
 from django.utils.html import conditional_escape, format_html
15 15
 from django.utils.encoding import smart_text, force_text, python_2_unicode_compatible
16 16
 from django.utils.safestring import mark_safe
  17
+from django.utils.translation import ugettext as _
17 18
 from django.utils import six
18 19
 
19 20
 
@@ -148,10 +149,13 @@ def _html_output(self, normal_row, error_row, row_ender, help_text_html, errors_
148 149
         for name, field in self.fields.items():
149 150
             html_class_attr = ''
150 151
             bf = self[name]
151  
-            bf_errors = self.error_class([conditional_escape(error) for error in bf.errors]) # Escape and cache in local variable.
  152
+            # Escape and cache in local variable.
  153
+            bf_errors = self.error_class([conditional_escape(error) for error in bf.errors])
152 154
             if bf.is_hidden:
153 155
                 if bf_errors:
154  
-                    top_errors.extend(['(Hidden field %s) %s' % (name, force_text(e)) for e in bf_errors])
  156
+                    top_errors.extend(
  157
+                        [_('(Hidden field %(name)s) %(error)s') % {'name': name, 'error': force_text(e)}
  158
+                         for e in bf_errors])
155 159
                 hidden_fields.append(six.text_type(bf))
156 160
             else:
157 161
                 # Create a 'class="..."' atribute if the row should have any

0 notes on commit 962f133

Please sign in to comment.
Something went wrong with that request. Please try again.