Fixed #7554 -- Modified contrib.localflavor to make use of ugettext, rather than ugettext. Thanks to msaelices for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7689 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2008-06-18 13:10:05 +00:00
parent 4317ba5799
commit e146e508da
21 changed files with 55 additions and 55 deletions

View File

@ -6,7 +6,7 @@ AR-specific Form helpers.
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES
from django.utils.encoding import smart_unicode from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
class ARProvinceSelect(Select): class ARProvinceSelect(Select):
""" """
@ -24,7 +24,7 @@ class ARPostalCodeField(RegexField):
See http://www.correoargentino.com.ar/consulta_cpa/home.php See http://www.correoargentino.com.ar/consulta_cpa/home.php
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext("Enter a postal code in the format NNNN or ANNNNAAA."), 'invalid': _("Enter a postal code in the format NNNN or ANNNNAAA."),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -46,8 +46,8 @@ class ARDNIField(CharField):
A field that validates 'Documento Nacional de Identidad' (DNI) numbers. A field that validates 'Documento Nacional de Identidad' (DNI) numbers.
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext("This field requires only numbers."), 'invalid': _("This field requires only numbers."),
'max_digits': ugettext("This field requires 7 or 8 digits."), 'max_digits': _("This field requires 7 or 8 digits."),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -76,8 +76,8 @@ class ARCUITField(RegexField):
CUIT is of the form XX-XXXXXXXX-V. The last digit is a check digit. CUIT is of the form XX-XXXXXXXX-V. The last digit is a check digit.
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format.'), 'invalid': _('Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format.'),
'checksum': ugettext("Invalid CUIT."), 'checksum': _("Invalid CUIT."),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -5,7 +5,7 @@ Australian-specific Form helpers
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
from django.newforms.util import smart_unicode from django.newforms.util import smart_unicode
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
import re import re
PHONE_DIGITS_RE = re.compile(r'^(\d{10})$') PHONE_DIGITS_RE = re.compile(r'^(\d{10})$')
@ -13,7 +13,7 @@ PHONE_DIGITS_RE = re.compile(r'^(\d{10})$')
class AUPostCodeField(RegexField): class AUPostCodeField(RegexField):
"""Australian post code field.""" """Australian post code field."""
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a 4 digit post code.'), 'invalid': _('Enter a 4 digit post code.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -6,7 +6,7 @@ BR-specific Form helpers
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import Field, RegexField, CharField, Select, EMPTY_VALUES from django.newforms.fields import Field, RegexField, CharField, Select, EMPTY_VALUES
from django.utils.encoding import smart_unicode from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext_lazy as _
import re import re
try: try:

View File

@ -5,7 +5,7 @@ Canada-specific Form helpers
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
from django.newforms.util import smart_unicode from django.newforms.util import smart_unicode
from django.utils.translation import gettext, ugettext from django.utils.translation import ugettext_lazy as _
import re import re
phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$') phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$')
@ -14,7 +14,7 @@ sin_re = re.compile(r"^(\d{3})-(\d{3})-(\d{3})$")
class CAPostalCodeField(RegexField): class CAPostalCodeField(RegexField):
"""Canadian postal code field.""" """Canadian postal code field."""
default_error_messages = { default_error_messages = {
'invalid': gettext(u'Enter a postal code in the format XXX XXX.'), 'invalid': _(u'Enter a postal code in the format XXX XXX.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -85,7 +85,7 @@ class CASocialInsuranceNumberField(Field):
See: http://en.wikipedia.org/wiki/Social_Insurance_Number See: http://en.wikipedia.org/wiki/Social_Insurance_Number
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a valid Canadian Social Insurance number in XXX-XXX-XXX format.'), 'invalid': _('Enter a valid Canadian Social Insurance number in XXX-XXX-XXX format.'),
} }
def clean(self, value): def clean(self, value):

View File

@ -5,7 +5,7 @@ Swiss-specific Form helpers
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
from django.utils.encoding import smart_unicode from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
import re import re
id_re = re.compile(r"^(?P<idnumber>\w{8})(?P<pos9>(\d{1}|<))(?P<checksum>\d{1})$") id_re = re.compile(r"^(?P<idnumber>\w{8})(?P<pos9>(\d{1}|<))(?P<checksum>\d{1})$")
@ -13,7 +13,7 @@ phone_digits_re = re.compile(r'^0([1-9]{1})\d{8}$')
class CHZipCodeField(RegexField): class CHZipCodeField(RegexField):
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a zip code in the format XXXX.'), 'invalid': _('Enter a zip code in the format XXXX.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -61,7 +61,7 @@ class CHIdentityCardNumberField(Field):
Algorithm is documented at http://adi.kousz.ch/artikel/IDCHE.htm Algorithm is documented at http://adi.kousz.ch/artikel/IDCHE.htm
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.'), 'invalid': _('Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.'),
} }
def has_valid_checksum(self, number): def has_valid_checksum(self, number):

View File

@ -4,7 +4,7 @@ Chile specific form helpers.
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import RegexField, Select, EMPTY_VALUES from django.newforms.fields import RegexField, Select, EMPTY_VALUES
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode from django.utils.encoding import smart_unicode
@ -26,9 +26,9 @@ class CLRutField(RegexField):
https://palena.sii.cl/cvc/dte/ee_empresas_emisoras.html https://palena.sii.cl/cvc/dte/ee_empresas_emisoras.html
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a valid Chilean RUT.'), 'invalid': _('Enter a valid Chilean RUT.'),
'strict': ugettext('Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.'), 'strict': _('Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.'),
'checksum': ugettext('The Chilean RUT is not valid.'), 'checksum': _('The Chilean RUT is not valid.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -4,14 +4,14 @@ DE-specific Form helpers
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
import re import re
id_re = re.compile(r"^(?P<residence>\d{10})(?P<origin>\w{1,3})[-\ ]?(?P<birthday>\d{7})[-\ ]?(?P<validity>\d{7})[-\ ]?(?P<checksum>\d{1})$") id_re = re.compile(r"^(?P<residence>\d{10})(?P<origin>\w{1,3})[-\ ]?(?P<birthday>\d{7})[-\ ]?(?P<validity>\d{7})[-\ ]?(?P<checksum>\d{1})$")
class DEZipCodeField(RegexField): class DEZipCodeField(RegexField):
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a zip code in the format XXXXX.'), 'invalid': _('Enter a zip code in the format XXXXX.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(DEZipCodeField, self).__init__(r'^\d{5}$', super(DEZipCodeField, self).__init__(r'^\d{5}$',
@ -38,7 +38,7 @@ class DEIdentityCardNumberField(Field):
Algorithm is documented at http://de.wikipedia.org/wiki/Personalausweis Algorithm is documented at http://de.wikipedia.org/wiki/Personalausweis
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.'), 'invalid': _('Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.'),
} }
def has_valid_checksum(self, number): def has_valid_checksum(self, number):

View File

@ -5,7 +5,7 @@ Spanish-specific Form helpers
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import RegexField, Select, EMPTY_VALUES from django.newforms.fields import RegexField, Select, EMPTY_VALUES
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext_lazy as _
import re import re
class ESPostalCodeField(RegexField): class ESPostalCodeField(RegexField):

View File

@ -5,11 +5,11 @@ FI-specific Form helpers
import re import re
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
class FIZipCodeField(RegexField): class FIZipCodeField(RegexField):
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a zip code in the format XXXXX.'), 'invalid': _('Enter a zip code in the format XXXXX.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(FIZipCodeField, self).__init__(r'^\d{5}$', super(FIZipCodeField, self).__init__(r'^\d{5}$',
@ -25,7 +25,7 @@ class FIMunicipalitySelect(Select):
class FISocialSecurityNumber(Field): class FISocialSecurityNumber(Field):
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a valid Finnish social security number.'), 'invalid': _('Enter a valid Finnish social security number.'),
} }
def clean(self, value): def clean(self, value):

View File

@ -5,14 +5,14 @@ FR-specific Form helpers
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
from django.utils.encoding import smart_unicode from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
import re import re
phone_digits_re = re.compile(r'^0\d(\s|\.)?(\d{2}(\s|\.)?){3}\d{2}$') phone_digits_re = re.compile(r'^0\d(\s|\.)?(\d{2}(\s|\.)?){3}\d{2}$')
class FRZipCodeField(RegexField): class FRZipCodeField(RegexField):
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a zip code in the format XXXXX.'), 'invalid': _('Enter a zip code in the format XXXXX.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -5,7 +5,7 @@ Iceland specific form helpers.
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import RegexField, EMPTY_VALUES from django.newforms.fields import RegexField, EMPTY_VALUES
from django.newforms.widgets import Select from django.newforms.widgets import Select
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode from django.utils.encoding import smart_unicode
class ISIdNumberField(RegexField): class ISIdNumberField(RegexField):
@ -14,8 +14,8 @@ class ISIdNumberField(RegexField):
of Iceland has. of Iceland has.
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a valid Icelandic identification number. The format is XXXXXX-XXXX.'), 'invalid': _('Enter a valid Icelandic identification number. The format is XXXXXX-XXXX.'),
'checksum': ugettext(u'The Icelandic identification number is not valid.'), 'checksum': _(u'The Icelandic identification number is not valid.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -4,14 +4,14 @@ IT-specific Form helpers
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode from django.utils.encoding import smart_unicode
from django.contrib.localflavor.it.util import ssn_check_digit, vat_number_check_digit from django.contrib.localflavor.it.util import ssn_check_digit, vat_number_check_digit
import re import re
class ITZipCodeField(RegexField): class ITZipCodeField(RegexField):
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a valid zip code.'), 'invalid': _('Enter a valid zip code.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(ITZipCodeField, self).__init__(r'^\d{5}$', super(ITZipCodeField, self).__init__(r'^\d{5}$',
@ -40,7 +40,7 @@ class ITSocialSecurityNumberField(RegexField):
'Informazioni sulla codificazione delle persone fisiche'. 'Informazioni sulla codificazione delle persone fisiche'.
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext(u'Enter a valid Social Security number.'), 'invalid': _(u'Enter a valid Social Security number.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -65,7 +65,7 @@ class ITVatNumberField(Field):
A form field that validates Italian VAT numbers (partita IVA). A form field that validates Italian VAT numbers (partita IVA).
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext(u'Enter a valid VAT number.'), 'invalid': _(u'Enter a valid VAT number.'),
} }
def clean(self, value): def clean(self, value):

View File

@ -4,7 +4,7 @@ JP-specific Form helpers
from django.core import validators from django.core import validators
from django.newforms import ValidationError from django.newforms import ValidationError
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
from django.newforms.fields import RegexField, Select from django.newforms.fields import RegexField, Select
class JPPostalCodeField(RegexField): class JPPostalCodeField(RegexField):
@ -14,7 +14,7 @@ class JPPostalCodeField(RegexField):
Accepts 7 digits, with or without a hyphen. Accepts 7 digits, with or without a hyphen.
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a postal code in the format XXXXXXX or XXX-XXXX.'), 'invalid': _('Enter a postal code in the format XXXXXXX or XXX-XXXX.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -6,7 +6,7 @@ import re
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import Field, Select, EMPTY_VALUES from django.newforms.fields import Field, Select, EMPTY_VALUES
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode from django.utils.encoding import smart_unicode
pc_re = re.compile('^\d{4}[A-Z]{2}$') pc_re = re.compile('^\d{4}[A-Z]{2}$')

View File

@ -5,11 +5,11 @@ Norwegian-specific Form helpers
import re, datetime import re, datetime
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
class NOZipCodeField(RegexField): class NOZipCodeField(RegexField):
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a zip code in the format XXXX.'), 'invalid': _('Enter a zip code in the format XXXX.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -30,7 +30,7 @@ class NOSocialSecurityNumber(Field):
Algorithm is documented at http://no.wikipedia.org/wiki/Personnummer Algorithm is documented at http://no.wikipedia.org/wiki/Personnummer
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext(u'Enter a valid Norwegian social security number.'), 'invalid': _(u'Enter a valid Norwegian social security number.'),
} }
def clean(self, value): def clean(self, value):

View File

@ -5,7 +5,7 @@ PE-specific Form helpers.
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
class PEDepartmentSelect(Select): class PEDepartmentSelect(Select):
""" """
@ -20,8 +20,8 @@ class PEDNIField(CharField):
A field that validates `Documento Nacional de IdentidadŽ (DNI) numbers. A field that validates `Documento Nacional de IdentidadŽ (DNI) numbers.
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext("This field requires only numbers."), 'invalid': _("This field requires only numbers."),
'max_digits': ugettext("This field requires 8 digits."), 'max_digits': _("This field requires 8 digits."),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -48,8 +48,8 @@ class PERUCField(RegexField):
the form XXXXXXXXXXX. the form XXXXXXXXXXX.
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext("This field requires only numbers."), 'invalid': _("This field requires only numbers."),
'max_digits': ugettext("This field requires 11 digits."), 'max_digits': _("This field requires 11 digits."),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -6,7 +6,7 @@ import re
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import Select, RegexField from django.newforms.fields import Select, RegexField
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext_lazy as _
class PLVoivodeshipSelect(Select): class PLVoivodeshipSelect(Select):
""" """

View File

@ -3,7 +3,7 @@ Slovak-specific form helpers
""" """
from django.newforms.fields import Select, RegexField from django.newforms.fields import Select, RegexField
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
class SKRegionSelect(Select): class SKRegionSelect(Select):
""" """
@ -27,7 +27,7 @@ class SKPostalCodeField(RegexField):
Valid form is XXXXX or XXX XX, where X represents integer. Valid form is XXXXX or XXX XX, where X represents integer.
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext(u'Enter a postal code in the format XXXXX or XXX XX.'), 'invalid': _(u'Enter a postal code in the format XXXXX or XXX XX.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -6,7 +6,7 @@ import re
from django.newforms.fields import CharField, Select from django.newforms.fields import CharField, Select
from django.newforms import ValidationError from django.newforms import ValidationError
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
class UKPostcodeField(CharField): class UKPostcodeField(CharField):
""" """
@ -18,7 +18,7 @@ class UKPostcodeField(CharField):
The value is uppercased and a space added in the correct place, if required. The value is uppercased and a space added in the correct place, if required.
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext(u'Enter a valid postcode.'), 'invalid': _(u'Enter a valid postcode.'),
} }
outcode_pattern = '[A-PR-UWYZ]([0-9]{1,2}|([A-HIK-Y][0-9](|[0-9]|[ABEHMNPRVWXY]))|[0-9][A-HJKSTUW])' outcode_pattern = '[A-PR-UWYZ]([0-9]{1,2}|([A-HIK-Y][0-9](|[0-9]|[ABEHMNPRVWXY]))|[0-9][A-HJKSTUW])'
incode_pattern = '[0-9][ABD-HJLNP-UW-Z]{2}' incode_pattern = '[0-9][ABD-HJLNP-UW-Z]{2}'

View File

@ -5,7 +5,7 @@ Sources:
Welsh regions: http://en.wikipedia.org/wiki/Preserved_counties_of_Wales Welsh regions: http://en.wikipedia.org/wiki/Preserved_counties_of_Wales
Scottish regions: http://en.wikipedia.org/wiki/Regions_and_districts_of_Scotland Scottish regions: http://en.wikipedia.org/wiki/Regions_and_districts_of_Scotland
""" """
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext_lazy as _
ENGLAND_REGION_CHOICES = ( ENGLAND_REGION_CHOICES = (
("Bedfordshire", _("Bedfordshire")), ("Bedfordshire", _("Bedfordshire")),

View File

@ -5,7 +5,7 @@ USA-specific Form helpers
from django.newforms import ValidationError from django.newforms import ValidationError
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
from django.utils.encoding import smart_unicode from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _
import re import re
phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$') phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$')
@ -13,7 +13,7 @@ ssn_re = re.compile(r"^(?P<area>\d{3})[-\ ]?(?P<group>\d{2})[-\ ]?(?P<serial>\d{
class USZipCodeField(RegexField): class USZipCodeField(RegexField):
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a zip code in the format XXXXX or XXXXX-XXXX.'), 'invalid': _('Enter a zip code in the format XXXXX or XXXXX-XXXX.'),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -51,7 +51,7 @@ class USSocialSecurityNumberField(Field):
1962 promotional number). 1962 promotional number).
""" """
default_error_messages = { default_error_messages = {
'invalid': ugettext('Enter a valid U.S. Social Security number in XXX-XX-XXXX format.'), 'invalid': _('Enter a valid U.S. Social Security number in XXX-XX-XXXX format.'),
} }
def clean(self, value): def clean(self, value):