Code

Ticket #20582: 20582-1.diff

File 20582-1.diff, 3.4 KB (added by claudep, 11 months ago)
Line 
1diff --git a/django/conf/locale/en/LC_MESSAGES/django.po b/django/conf/locale/en/LC_MESSAGES/django.po
2index 371f0af..f8069f0 100644
3--- a/django/conf/locale/en/LC_MESSAGES/django.po
4+++ b/django/conf/locale/en/LC_MESSAGES/django.po
5@@ -4,7 +4,7 @@ msgid ""
6 msgstr ""
7 "Project-Id-Version: Django\n"
8 "Report-Msgid-Bugs-To: \n"
9-"POT-Creation-Date: 2013-05-25 14:27+0200\n"
10+"POT-Creation-Date: 2013-06-11 18:44+0200\n"
11 "PO-Revision-Date: 2010-05-13 15:35+0200\n"
12 "Last-Translator: Django team\n"
13 "Language-Team: English <en@li.org>\n"
14@@ -699,11 +699,22 @@ msgstr ""
15 msgid "Enter a list of values."
16 msgstr ""
17 
18-#: forms/forms.py:158
19+#. Translators: This is the default suffix added to form field labels
20+#: forms/forms.py:90
21+msgid ":"
22+msgstr ""
23+
24+#: forms/forms.py:159
25 #, python-format
26 msgid "(Hidden field %(name)s) %(error)s"
27 msgstr ""
28 
29+#. Translators: If found as last label character, these punctuation
30+#. characters will prevent the default label_suffix to be appended to the label
31+#: forms/forms.py:525
32+msgid ":?.!"
33+msgstr ""
34+
35 #: forms/formsets.py:310
36 #, python-format
37 msgid "Please submit %d or fewer forms."
38diff --git a/django/forms/forms.py b/django/forms/forms.py
39index e6a11f2..0bc45b7 100644
40--- a/django/forms/forms.py
41+++ b/django/forms/forms.py
42@@ -77,7 +77,7 @@ class BaseForm(object):
43     # information. Any improvements to the form API should be made to *this*
44     # class, not to the Form class.
45     def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
46-                 initial=None, error_class=ErrorList, label_suffix=':',
47+                 initial=None, error_class=ErrorList, label_suffix=None,
48                  empty_permitted=False):
49         self.is_bound = data is not None or files is not None
50         self.data = data or {}
51@@ -86,7 +86,8 @@ class BaseForm(object):
52         self.prefix = prefix
53         self.initial = initial or {}
54         self.error_class = error_class
55-        self.label_suffix = label_suffix
56+        # Translators: This is the default suffix added to form field labels
57+        self.label_suffix = label_suffix if label_suffix is not None else _(':')
58         self.empty_permitted = empty_permitted
59         self._errors = None # Stores the errors after clean() has been called.
60         self._changed_data = None
61@@ -519,7 +520,9 @@ class BoundField(object):
62         contents = contents or self.label
63         # Only add the suffix if the label does not end in punctuation.
64         if self.form.label_suffix:
65-            if contents[-1] not in ':?.!':
66+            # Translators: If found as last label character, these punctuation
67+            # characters will prevent the default label_suffix to be appended to the label
68+            if contents[-1] not in _(':?.!'):
69                 contents = format_html('{0}{1}', contents, self.form.label_suffix)
70         widget = self.field.widget
71         id_ = widget.attrs.get('id') or self.auto_id
72diff --git a/django/forms/models.py b/django/forms/models.py
73index 65434a6..71b2235 100644
74--- a/django/forms/models.py
75+++ b/django/forms/models.py
76@@ -270,7 +270,7 @@ class ModelFormMetaclass(type):
77 
78 class BaseModelForm(BaseForm):
79     def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
80-                 initial=None, error_class=ErrorList, label_suffix=':',
81+                 initial=None, error_class=ErrorList, label_suffix=None,
82                  empty_permitted=False, instance=None):
83         opts = self._meta
84         if opts.model is None: