Ticket #3600: newforms_translation_fix.patch

File newforms_translation_fix.patch, 1.9 KB (added by karsu, 18 years ago)

Newforms label and help_text translation patch

  • fields.py

     
    4949        #            *not* used as a fallback if data isn't given.
    5050        # help_text -- An optional string to use as "help text" for this Field.
    5151        if label is not None:
    52             label = smart_unicode(label)
     52            label = label
    5353        self.required, self.label, self.initial = required, label, initial
    54         self.help_text = smart_unicode(help_text or '')
     54        self.help_text = help_text or ''
    5555        widget = widget or self.widget
    5656        if isinstance(widget, type):
    5757            widget = widget()
  • forms.py

     
    88from widgets import TextInput, Textarea, HiddenInput, MultipleHiddenInput
    99from util import flatatt, StrAndUnicode, ErrorDict, ErrorList, ValidationError
    1010import copy
     11from util import smart_unicode
    1112
    1213__all__ = ('BaseForm', 'Form')
    1314
     
    123124                    output.append(error_row % bf_errors)
    124125                label = bf.label and bf.label_tag(escape(bf.label + ':')) or ''
    125126                if field.help_text:
    126                     help_text = help_text_html % field.help_text
     127                    help_text = help_text_html % smart_unicode(field.help_text)
    127128                else:
    128129                    help_text = u''
    129                 output.append(normal_row % {'errors': bf_errors, 'label': label, 'field': unicode(bf), 'help_text': help_text})
     130                output.append(normal_row % {'errors': bf_errors, 'label': smart_unicode(label), 'field': unicode(bf), 'help_text': help_text})
    130131        if top_errors:
    131132            output.insert(0, error_row % top_errors)
    132133        if hidden_fields: # Insert any hidden fields in the last row.
Back to Top