Skip to content

Commit

Permalink
Fixed #8879 -- Used ungettext instead of ngettext in the comments fra…
Browse files Browse the repository at this point in the history
…mework.

Patch from zgoda.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9116 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Oct 5, 2008
1 parent cf34d1f commit 18f13ae
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions django/contrib/comments/forms.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from django.utils.encoding import force_unicode from django.utils.encoding import force_unicode
from django.utils.hashcompat import sha_constructor from django.utils.hashcompat import sha_constructor
from django.utils.text import get_text_list from django.utils.text import get_text_list
from django.utils.translation import ngettext from django.utils.translation import ungettext, ugettext_lazy as _
from django.utils.translation import ugettext_lazy as _


COMMENT_MAX_LENGTH = getattr(settings,'COMMENT_MAX_LENGTH', 3000) COMMENT_MAX_LENGTH = getattr(settings,'COMMENT_MAX_LENGTH', 3000)


Expand Down Expand Up @@ -122,7 +121,7 @@ def clean_comment(self):
bad_words = [w for w in settings.PROFANITIES_LIST if w in comment.lower()] bad_words = [w for w in settings.PROFANITIES_LIST if w in comment.lower()]
if bad_words: if bad_words:
plural = len(bad_words) > 1 plural = len(bad_words) > 1
raise forms.ValidationError(ngettext( raise forms.ValidationError(ungettext(
"Watch your mouth! The word %s is not allowed here.", "Watch your mouth! The word %s is not allowed here.",
"Watch your mouth! The words %s are not allowed here.", plural) % \ "Watch your mouth! The words %s are not allowed here.", plural) % \
get_text_list(['"%s%s%s"' % (i[0], '-'*(len(i)-2), i[-1]) for i in bad_words], 'and')) get_text_list(['"%s%s%s"' % (i[0], '-'*(len(i)-2), i[-1]) for i in bad_words], 'and'))
Expand Down

0 comments on commit 18f13ae

Please sign in to comment.