Ticket #3882: localflavor_br_en_messages.diff

File localflavor_br_en_messages.diff, 3.3 KB (added by Wiliam Alves de Souza <wiliamsouza83@…>, 8 years ago)
  • django/contrib/localflavor/br/forms.py

     
    1515    def __init__(self, *args, **kwargs):
    1616        super(BRZipCodeField, self).__init__(r'^\d{5}-\d{3}$',
    1717            max_length=None, min_length=None,
    18             error_message=u'Informe um código postal no formato XXXXX-XXX.',
     18            error_message=gettext(u'Enter a zip code in the format XXXXX-XXX.'),
    1919            *args, **kwargs)
    2020
    2121class BRPhoneNumberField(Field):
     
    2727        m = phone_digits_re.search(value)
    2828        if m:
    2929            return u'%s-%s-%s' % (m.group(1), m.group(2), m.group(3))
    30         raise ValidationError(u'Números de telefone devem estar no formato XX-XXXX-XXXX.')
     30        raise ValidationError(gettext(u'Phone numbers must be in XX-XXXX-XXXX format.'))
    3131
    3232class BRStateSelect(Select):
    3333    """
  • tests/regressiontests/forms/localflavor.py

     
    734734>>> f.clean('12345_123')
    735735Traceback (most recent call last):
    736736...
    737 ValidationError: [u'Informe um c\xf3digo postal no formato XXXXX-XXX.']
     737ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
    738738>>> f.clean('1234-123')
    739739Traceback (most recent call last):
    740740...
    741 ValidationError: [u'Informe um c\xf3digo postal no formato XXXXX-XXX.']
     741ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
    742742>>> f.clean('abcde-abc')
    743743Traceback (most recent call last):
    744744...
    745 ValidationError: [u'Informe um c\xf3digo postal no formato XXXXX-XXX.']
     745ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
    746746>>> f.clean('12345-')
    747747Traceback (most recent call last):
    748748...
    749 ValidationError: [u'Informe um c\xf3digo postal no formato XXXXX-XXX.']
     749ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
    750750>>> f.clean('-123')
    751751Traceback (most recent call last):
    752752...
    753 ValidationError: [u'Informe um c\xf3digo postal no formato XXXXX-XXX.']
     753ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
    754754>>> f.clean('')
    755755Traceback (most recent call last):
    756756...
     
    768768>>> f.clean('-123')
    769769Traceback (most recent call last):
    770770...
    771 ValidationError: [u'Informe um c\xf3digo postal no formato XXXXX-XXX.']
     771ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
    772772>>> f.clean('12345-')
    773773Traceback (most recent call last):
    774774...
    775 ValidationError: [u'Informe um c\xf3digo postal no formato XXXXX-XXX.']
     775ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
    776776>>> f.clean('abcde-abc')
    777777Traceback (most recent call last):
    778778...
    779 ValidationError: [u'Informe um c\xf3digo postal no formato XXXXX-XXX.']
     779ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
    780780>>> f.clean('1234-123')
    781781Traceback (most recent call last):
    782782...
    783 ValidationError: [u'Informe um c\xf3digo postal no formato XXXXX-XXX.']
     783ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
    784784>>> f.clean('12345_123')
    785785Traceback (most recent call last):
    786786...
    787 ValidationError: [u'Informe um c\xf3digo postal no formato XXXXX-XXX.']
     787ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
    788788>>> f.clean('12345-123')
    789789u'12345-123'
    790790
Back to Top