Ticket #7316: localflavor_r7554.diff
File localflavor_r7554.diff, 20.9 KB (added by , 16 years ago) |
---|
-
django/contrib/localflavor/uk/uk_regions.py
5 5 Welsh regions: http://en.wikipedia.org/wiki/Preserved_counties_of_Wales 6 6 Scottish regions: http://en.wikipedia.org/wiki/Regions_and_districts_of_Scotland 7 7 """ 8 from django.utils.translation import ugettext as _8 from django.utils.translation import ugettext_lazy as _ 9 9 10 10 ENGLAND_REGION_CHOICES = ( 11 11 ("Bedfordshire", _("Bedfordshire")), -
django/contrib/localflavor/uk/forms.py
6 6 7 7 from django.newforms.fields import CharField, Select 8 8 from django.newforms import ValidationError 9 from django.utils.translation import ugettext 9 from django.utils.translation import ugettext_lazy as _ 10 10 11 11 class UKPostcodeField(CharField): 12 12 """ … … 18 18 The value is uppercased and a space added in the correct place, if required. 19 19 """ 20 20 default_error_messages = { 21 'invalid': ugettext(u'Enter a valid postcode.'),21 'invalid': _(u'Enter a valid postcode.'), 22 22 } 23 23 outcode_pattern = '[A-PR-UWYZ]([0-9]{1,2}|([A-HIK-Y][0-9](|[0-9]|[ABEHMNPRVWXY]))|[0-9][A-HJKSTUW])' 24 24 incode_pattern = '[0-9][ABD-HJLNP-UW-Z]{2}' -
django/contrib/localflavor/ca/forms.py
5 5 from django.newforms import ValidationError 6 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 7 from django.newforms.util import smart_unicode 8 from django.utils.translation import gettext, ugettext8 from django.utils.translation import ugettext_lazy as _ 9 9 import re 10 10 11 11 phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$') … … 14 14 class CAPostalCodeField(RegexField): 15 15 """Canadian postal code field.""" 16 16 default_error_messages = { 17 'invalid': gettext(u'Enter a postal code in the format XXX XXX.'),17 'invalid': _(u'Enter a postal code in the format XXX XXX.'), 18 18 } 19 19 20 20 def __init__(self, *args, **kwargs): … … 85 85 See: http://en.wikipedia.org/wiki/Social_Insurance_Number 86 86 """ 87 87 default_error_messages = { 88 'invalid': ugettext('Enter a valid Canadian Social Insurance number in XXX-XXX-XXX format.'),88 'invalid': _('Enter a valid Canadian Social Insurance number in XXX-XXX-XXX format.'), 89 89 } 90 90 91 91 def clean(self, value): -
django/contrib/localflavor/us/forms.py
5 5 from django.newforms import ValidationError 6 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 7 from django.utils.encoding import smart_unicode 8 from django.utils.translation import ugettext 8 from django.utils.translation import ugettext_lazy as _ 9 9 import re 10 10 11 11 phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$') … … 13 13 14 14 class USZipCodeField(RegexField): 15 15 default_error_messages = { 16 'invalid': ugettext('Enter a zip code in the format XXXXX or XXXXX-XXXX.'),16 'invalid': _('Enter a zip code in the format XXXXX or XXXXX-XXXX.'), 17 17 } 18 18 19 19 def __init__(self, *args, **kwargs): … … 51 51 1962 promotional number). 52 52 """ 53 53 default_error_messages = { 54 'invalid': ugettext('Enter a valid U.S. Social Security number in XXX-XX-XXXX format.'),54 'invalid': _('Enter a valid U.S. Social Security number in XXX-XX-XXXX format.'), 55 55 } 56 56 57 57 def clean(self, value): -
django/contrib/localflavor/de/forms.py
4 4 5 5 from django.newforms import ValidationError 6 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 from django.utils.translation import ugettext 7 from django.utils.translation import ugettext_lazy as _ 8 8 import re 9 9 10 10 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})$") 11 11 12 12 class DEZipCodeField(RegexField): 13 13 default_error_messages = { 14 'invalid': ugettext('Enter a zip code in the format XXXXX.'),14 'invalid': _('Enter a zip code in the format XXXXX.'), 15 15 } 16 16 def __init__(self, *args, **kwargs): 17 17 super(DEZipCodeField, self).__init__(r'^\d{5}$', … … 38 38 Algorithm is documented at http://de.wikipedia.org/wiki/Personalausweis 39 39 """ 40 40 default_error_messages = { 41 'invalid': ugettext('Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.'),41 'invalid': _('Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.'), 42 42 } 43 43 44 44 def has_valid_checksum(self, number): -
django/contrib/localflavor/ch/forms.py
5 5 from django.newforms import ValidationError 6 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 7 from django.utils.encoding import smart_unicode 8 from django.utils.translation import ugettext 8 from django.utils.translation import ugettext_lazy as _ 9 9 import re 10 10 11 11 id_re = re.compile(r"^(?P<idnumber>\w{8})(?P<pos9>(\d{1}|<))(?P<checksum>\d{1})$") … … 13 13 14 14 class CHZipCodeField(RegexField): 15 15 default_error_messages = { 16 'invalid': ugettext('Enter a zip code in the format XXXX.'),16 'invalid': _('Enter a zip code in the format XXXX.'), 17 17 } 18 18 19 19 def __init__(self, *args, **kwargs): … … 61 61 Algorithm is documented at http://adi.kousz.ch/artikel/IDCHE.htm 62 62 """ 63 63 default_error_messages = { 64 'invalid': ugettext('Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.'),64 'invalid': _('Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.'), 65 65 } 66 66 67 67 def has_valid_checksum(self, number): -
django/contrib/localflavor/fi/forms.py
5 5 import re 6 6 from django.newforms import ValidationError 7 7 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 8 from django.utils.translation import ugettext 8 from django.utils.translation import ugettext_lazy as _ 9 9 10 10 class FIZipCodeField(RegexField): 11 11 default_error_messages = { 12 'invalid': ugettext('Enter a zip code in the format XXXXX.'),12 'invalid': _('Enter a zip code in the format XXXXX.'), 13 13 } 14 14 def __init__(self, *args, **kwargs): 15 15 super(FIZipCodeField, self).__init__(r'^\d{5}$', … … 25 25 26 26 class FISocialSecurityNumber(Field): 27 27 default_error_messages = { 28 'invalid': ugettext('Enter a valid Finnish social security number.'),28 'invalid': _('Enter a valid Finnish social security number.'), 29 29 } 30 30 31 31 def clean(self, value): -
django/contrib/localflavor/cl/forms.py
4 4 5 5 from django.newforms import ValidationError 6 6 from django.newforms.fields import RegexField, Select, EMPTY_VALUES 7 from django.utils.translation import ugettext 7 from django.utils.translation import ugettext_lazy as _ 8 8 from django.utils.encoding import smart_unicode 9 9 10 10 … … 26 26 https://palena.sii.cl/cvc/dte/ee_empresas_emisoras.html 27 27 """ 28 28 default_error_messages = { 29 'invalid': ugettext('Enter a valid Chilean RUT.'),30 'strict': ugettext('Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.'),31 'checksum': ugettext('The Chilean RUT is not valid.'),29 'invalid': _('Enter a valid Chilean RUT.'), 30 'strict': _('Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.'), 31 'checksum': _('The Chilean RUT is not valid.'), 32 32 } 33 33 34 34 def __init__(self, *args, **kwargs): -
django/contrib/localflavor/ar/forms.py
6 6 from django.newforms import ValidationError 7 7 from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES 8 8 from django.utils.encoding import smart_unicode 9 from django.utils.translation import ugettext 9 from django.utils.translation import ugettext_lazy as _ 10 10 11 11 class ARProvinceSelect(Select): 12 12 """ … … 24 24 See http://www.correoargentino.com.ar/consulta_cpa/home.php 25 25 """ 26 26 default_error_messages = { 27 'invalid': ugettext("Enter a postal code in the format NNNN or ANNNNAAA."),27 'invalid': _("Enter a postal code in the format NNNN or ANNNNAAA."), 28 28 } 29 29 30 30 def __init__(self, *args, **kwargs): … … 46 46 A field that validates 'Documento Nacional de Identidad' (DNI) numbers. 47 47 """ 48 48 default_error_messages = { 49 'invalid': ugettext("This field requires only numbers."),50 'max_digits': ugettext("This field requires 7 or 8 digits."),49 'invalid': _("This field requires only numbers."), 50 'max_digits': _("This field requires 7 or 8 digits."), 51 51 } 52 52 53 53 def __init__(self, *args, **kwargs): … … 76 76 CUIT is of the form XX-XXXXXXXX-V. The last digit is a check digit. 77 77 """ 78 78 default_error_messages = { 79 'invalid': ugettext('Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format.'),80 'checksum': ugettext("Invalid CUIT."),79 'invalid': _('Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format.'), 80 'checksum': _("Invalid CUIT."), 81 81 } 82 82 83 83 def __init__(self, *args, **kwargs): -
django/contrib/localflavor/br/forms.py
6 6 from django.newforms import ValidationError 7 7 from django.newforms.fields import Field, RegexField, CharField, Select, EMPTY_VALUES 8 8 from django.utils.encoding import smart_unicode 9 from django.utils.translation import ugettext as _9 from django.utils.translation import ugettext_lazy as _ 10 10 import re 11 11 12 12 try: -
django/contrib/localflavor/pe/forms.py
5 5 6 6 from django.newforms import ValidationError 7 7 from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES 8 from django.utils.translation import ugettext 8 from django.utils.translation import ugettext_lazy as _ 9 9 10 10 class PEDepartmentSelect(Select): 11 11 """ … … 20 20 A field that validates `Documento Nacional de IdentidadŽ (DNI) numbers. 21 21 """ 22 22 default_error_messages = { 23 'invalid': ugettext("This field requires only numbers."),24 'max_digits': ugettext("This field requires 8 digits."),23 'invalid': _("This field requires only numbers."), 24 'max_digits': _("This field requires 8 digits."), 25 25 } 26 26 27 27 def __init__(self, *args, **kwargs): … … 48 48 the form XXXXXXXXXXX. 49 49 """ 50 50 default_error_messages = { 51 'invalid': ugettext("This field requires only numbers."),52 'max_digits': ugettext("This field requires 11 digits."),51 'invalid': _("This field requires only numbers."), 52 'max_digits': _("This field requires 11 digits."), 53 53 } 54 54 55 55 def __init__(self, *args, **kwargs): -
django/contrib/localflavor/au/forms.py
5 5 from django.newforms import ValidationError 6 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 7 from django.newforms.util import smart_unicode 8 from django.utils.translation import ugettext 8 from django.utils.translation import ugettext_lazy as _ 9 9 import re 10 10 11 11 PHONE_DIGITS_RE = re.compile(r'^(\d{10})$') … … 13 13 class AUPostCodeField(RegexField): 14 14 """Australian post code field.""" 15 15 default_error_messages = { 16 'invalid': ugettext('Enter a 4 digit post code.'),16 'invalid': _('Enter a 4 digit post code.'), 17 17 } 18 18 19 19 def __init__(self, *args, **kwargs): -
django/contrib/localflavor/es/forms.py
5 5 6 6 from django.newforms import ValidationError 7 7 from django.newforms.fields import RegexField, Select, EMPTY_VALUES 8 from django.utils.translation import ugettext as _8 from django.utils.translation import ugettext_lazy as _ 9 9 import re 10 10 11 11 class ESPostalCodeField(RegexField): -
django/contrib/localflavor/fr/forms.py
5 5 from django.newforms import ValidationError 6 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 7 from django.utils.encoding import smart_unicode 8 from django.utils.translation import ugettext 8 from django.utils.translation import ugettext_lazy as _ 9 9 import re 10 10 11 11 phone_digits_re = re.compile(r'^0\d(\s|\.)?(\d{2}(\s|\.)?){3}\d{2}$') 12 12 13 13 class FRZipCodeField(RegexField): 14 14 default_error_messages = { 15 'invalid': ugettext('Enter a zip code in the format XXXXX.'),15 'invalid': _('Enter a zip code in the format XXXXX.'), 16 16 } 17 17 18 18 def __init__(self, *args, **kwargs): -
django/contrib/localflavor/nl/forms.py
6 6 7 7 from django.newforms import ValidationError 8 8 from django.newforms.fields import Field, Select, EMPTY_VALUES 9 from django.utils.translation import ugettext as _9 from django.utils.translation import ugettext_lazy as _ 10 10 from django.utils.encoding import smart_unicode 11 11 12 12 pc_re = re.compile('^\d{4}[A-Z]{2}$') -
django/contrib/localflavor/jp/forms.py
4 4 5 5 from django.core import validators 6 6 from django.newforms import ValidationError 7 from django.utils.translation import ugettext 7 from django.utils.translation import ugettext_lazy as _ 8 8 from django.newforms.fields import RegexField, Select 9 9 10 10 class JPPostalCodeField(RegexField): … … 14 14 Accepts 7 digits, with or without a hyphen. 15 15 """ 16 16 default_error_messages = { 17 'invalid': ugettext('Enter a postal code in the format XXXXXXX or XXX-XXXX.'),17 'invalid': _('Enter a postal code in the format XXXXXXX or XXX-XXXX.'), 18 18 } 19 19 20 20 def __init__(self, *args, **kwargs): -
django/contrib/localflavor/is_/forms.py
5 5 from django.newforms import ValidationError 6 6 from django.newforms.fields import RegexField, EMPTY_VALUES 7 7 from django.newforms.widgets import Select 8 from django.utils.translation import ugettext 8 from django.utils.translation import ugettext_lazy as _ 9 9 from django.utils.encoding import smart_unicode 10 10 11 11 class ISIdNumberField(RegexField): … … 14 14 of Iceland has. 15 15 """ 16 16 default_error_messages = { 17 'invalid': ugettext('Enter a valid Icelandic identification number. The format is XXXXXX-XXXX.'),18 'checksum': ugettext(u'The Icelandic identification number is not valid.'),17 'invalid': _('Enter a valid Icelandic identification number. The format is XXXXXX-XXXX.'), 18 'checksum': _(u'The Icelandic identification number is not valid.'), 19 19 } 20 20 21 21 def __init__(self, *args, **kwargs): -
django/contrib/localflavor/pl/forms.py
6 6 7 7 from django.newforms import ValidationError 8 8 from django.newforms.fields import Select, RegexField 9 from django.utils.translation import ugettext as _9 from django.utils.translation import ugettext_lazy as _ 10 10 11 11 class PLVoivodeshipSelect(Select): 12 12 """ -
django/contrib/localflavor/no/forms.py
5 5 import re, datetime 6 6 from django.newforms import ValidationError 7 7 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 8 from django.utils.translation import ugettext 8 from django.utils.translation import ugettext_lazy as _ 9 9 10 10 class NOZipCodeField(RegexField): 11 11 default_error_messages = { 12 'invalid': ugettext('Enter a zip code in the format XXXX.'),12 'invalid': _('Enter a zip code in the format XXXX.'), 13 13 } 14 14 15 15 def __init__(self, *args, **kwargs): … … 30 30 Algorithm is documented at http://no.wikipedia.org/wiki/Personnummer 31 31 """ 32 32 default_error_messages = { 33 'invalid': ugettext(u'Enter a valid Norwegian social security number.'),33 'invalid': _(u'Enter a valid Norwegian social security number.'), 34 34 } 35 35 36 36 def clean(self, value): -
django/contrib/localflavor/it/forms.py
4 4 5 5 from django.newforms import ValidationError 6 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 from django.utils.translation import ugettext 7 from django.utils.translation import ugettext_lazy as _ 8 8 from django.utils.encoding import smart_unicode 9 9 from django.contrib.localflavor.it.util import ssn_check_digit, vat_number_check_digit 10 10 import re 11 11 12 12 class ITZipCodeField(RegexField): 13 13 default_error_messages = { 14 'invalid': ugettext('Enter a valid zip code.'),14 'invalid': _('Enter a valid zip code.'), 15 15 } 16 16 def __init__(self, *args, **kwargs): 17 17 super(ITZipCodeField, self).__init__(r'^\d{5}$', … … 40 40 'Informazioni sulla codificazione delle persone fisiche'. 41 41 """ 42 42 default_error_messages = { 43 'invalid': ugettext(u'Enter a valid Social Security number.'),43 'invalid': _(u'Enter a valid Social Security number.'), 44 44 } 45 45 46 46 def __init__(self, *args, **kwargs): … … 65 65 A form field that validates Italian VAT numbers (partita IVA). 66 66 """ 67 67 default_error_messages = { 68 'invalid': ugettext(u'Enter a valid VAT number.'),68 'invalid': _(u'Enter a valid VAT number.'), 69 69 } 70 70 71 71 def clean(self, value): -
django/contrib/localflavor/sk/forms.py
3 3 """ 4 4 5 5 from django.newforms.fields import Select, RegexField 6 from django.utils.translation import ugettext 6 from django.utils.translation import ugettext_lazy as _ 7 7 8 8 class SKRegionSelect(Select): 9 9 """ … … 27 27 Valid form is XXXXX or XXX XX, where X represents integer. 28 28 """ 29 29 default_error_messages = { 30 'invalid': ugettext(u'Enter a postal code in the format XXXXX or XXX XX.'),30 'invalid': _(u'Enter a postal code in the format XXXXX or XXX XX.'), 31 31 } 32 32 33 33 def __init__(self, *args, **kwargs):