Code

Ticket #16403: django-comments-ungettext.2.diff

File django-comments-ungettext.2.diff, 1.0 KB (added by Ferry Jérémie <ferryjeremie@…>, 2 years ago)
Line 
1Index: django/contrib/comments/forms.py
2===================================================================
3--- django/contrib/comments/forms.py    (revision 16502)
4+++ django/contrib/comments/forms.py    (working copy)
5@@ -186,11 +186,10 @@
6         if settings.COMMENTS_ALLOW_PROFANITIES == False:
7             bad_words = [w for w in settings.PROFANITIES_LIST if w in comment.lower()]
8             if bad_words:
9-                plural = len(bad_words) > 1
10                 raise forms.ValidationError(ungettext(
11                     "Watch your mouth! The word %s is not allowed here.",
12-                    "Watch your mouth! The words %s are not allowed here.", plural) % \
13-                    get_text_list(['"%s%s%s"' % (i[0], '-'*(len(i)-2), i[-1]) for i in bad_words], 'and'))
14+                    "Watch your mouth! The words %s are not allowed here.", len(bad_words)) % \
15+                    get_text_list(['"%s%s%s"' % (i[0], '-'*(len(i)-2), i[-1]) for i in bad_words], _('and')))
16         return comment
17 
18 class CommentForm(CommentDetailsForm):