Commit 1cb1d18176f6d0e5147eccca1ea995ab3b178265
1 parent
b44ded19
Added context marker for the CommentDetailsForm.name field
Some languages (like Czech) translate "Name" differently depending on the context. The added context marker will help translators to make the right choice. Thanks Petr Dlouhy for the report and the initial patch.
Showing
3 changed files
with
7 additions
and
7 deletions
| @@ -13,7 +13,7 @@ from django.utils.crypto import salted_hmac, constant_time_compare | @@ -13,7 +13,7 @@ from django.utils.crypto import salted_hmac, constant_time_compare | ||
| 13 | from django.utils.encoding import force_text | 13 | from django.utils.encoding import force_text |
| 14 | from django.utils.text import get_text_list | 14 | from django.utils.text import get_text_list |
| 15 | from django.utils import timezone | 15 | from django.utils import timezone |
| 16 | -from django.utils.translation import ungettext, ugettext, ugettext_lazy as _ | 16 | +from django.utils.translation import pgettext_lazy, ungettext, ugettext, ugettext_lazy as _ |
| 17 | from django_comments.models import Comment | 17 | from django_comments.models import Comment |
| 18 | 18 | ||
| 19 | COMMENT_MAX_LENGTH = getattr(settings, 'COMMENT_MAX_LENGTH', 3000) | 19 | COMMENT_MAX_LENGTH = getattr(settings, 'COMMENT_MAX_LENGTH', 3000) |
| @@ -102,7 +102,7 @@ class CommentDetailsForm(CommentSecurityForm): | @@ -102,7 +102,7 @@ class CommentDetailsForm(CommentSecurityForm): | ||
| 102 | """ | 102 | """ |
| 103 | Handles the specific details of the comment (name, comment, etc.). | 103 | Handles the specific details of the comment (name, comment, etc.). |
| 104 | """ | 104 | """ |
| 105 | - name = forms.CharField(label=_("Name"), max_length=50) | 105 | + name = forms.CharField(label=pgettext_lazy("Person name", "Name"), max_length=50) |
| 106 | email = forms.EmailField(label=_("Email address")) | 106 | email = forms.EmailField(label=_("Email address")) |
| 107 | url = forms.URLField(label=_("URL"), required=False) | 107 | url = forms.URLField(label=_("URL"), required=False) |
| 108 | comment = forms.CharField(label=_('Comment'), widget=forms.Textarea, | 108 | comment = forms.CharField(label=_('Comment'), widget=forms.Textarea, |
| @@ -6,14 +6,14 @@ msgid "" | @@ -6,14 +6,14 @@ msgid "" | ||
| 6 | msgstr "" | 6 | msgstr "" |
| 7 | "Project-Id-Version: Django\n" | 7 | "Project-Id-Version: Django\n" |
| 8 | "Report-Msgid-Bugs-To: \n" | 8 | "Report-Msgid-Bugs-To: \n" |
| 9 | -"POT-Creation-Date: 2012-10-15 10:56+0200\n" | 9 | +"POT-Creation-Date: 2015-06-22 17:28+0200\n" |
| 10 | "PO-Revision-Date: 2012-02-14 13:24+0000\n" | 10 | "PO-Revision-Date: 2012-02-14 13:24+0000\n" |
| 11 | "Last-Translator: Jannis Leidel <jannis@leidel.info>\n" | 11 | "Last-Translator: Jannis Leidel <jannis@leidel.info>\n" |
| 12 | "Language-Team: English <en@li.org>\n" | 12 | "Language-Team: English <en@li.org>\n" |
| 13 | +"Language: en\n" | ||
| 13 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
| 14 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
| 15 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
| 16 | -"Language: en\n" | ||
| 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" | 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" |
| 18 | 18 | ||
| 19 | #: admin.py:25 | 19 | #: admin.py:25 |
| @@ -71,7 +71,8 @@ msgstr "%(site_name)s comments" | @@ -71,7 +71,8 @@ msgstr "%(site_name)s comments" | ||
| 71 | msgid "Latest comments on %(site_name)s" | 71 | msgid "Latest comments on %(site_name)s" |
| 72 | msgstr "Latest comments on %(site_name)s" | 72 | msgstr "Latest comments on %(site_name)s" |
| 73 | 73 | ||
| 74 | -#: forms.py:96 | 74 | +#: forms.py:105 |
| 75 | +msgctxt "Person name" | ||
| 75 | msgid "Name" | 76 | msgid "Name" |
| 76 | msgstr "Name" | 77 | msgstr "Name" |
| 77 | 78 |
| @@ -9,8 +9,7 @@ | @@ -9,8 +9,7 @@ | ||
| 9 | {% if next %} | 9 | {% if next %} |
| 10 | <div><input type="hidden" name="next" value="{{ next }}"/></div>{% endif %} | 10 | <div><input type="hidden" name="next" value="{{ next }}"/></div>{% endif %} |
| 11 | {% if form.errors %} | 11 | {% if form.errors %} |
| 12 | - <h1>{% blocktrans count counter=form.errors|length %}Please correct the error below{% plural %}Please correct the | ||
| 13 | - errors below{% endblocktrans %}</h1> | 12 | + <h1>{% blocktrans count counter=form.errors|length %}Please correct the error below{% plural %}Please correct the errors below{% endblocktrans %}</h1> |
| 14 | {% else %} | 13 | {% else %} |
| 15 | <h1>{% trans "Preview your comment" %}</h1> | 14 | <h1>{% trans "Preview your comment" %}</h1> |
| 16 | <blockquote>{{ comment|linebreaks }}</blockquote> | 15 | <blockquote>{{ comment|linebreaks }}</blockquote> |
Please
register
or
login
to post a comment