Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.0.X] Fixed #10633, #10691: marked strings in the comments app for …

…translation. Thanks, zgoda. Backport of r10427 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10430 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1c2ee287c0d6ff8b8dc7e60e242ed7691298ad0d 1 parent 6951cec
@jacobian jacobian authored
View
5 django/contrib/comments/feeds.py
@@ -2,6 +2,7 @@
from django.contrib.syndication.feeds import Feed
from django.contrib.sites.models import Site
from django.contrib import comments
+from django.utils.translation import ugettext as _
class LatestCommentFeed(Feed):
"""Feed of latest comments on the current site."""
@@ -9,7 +10,7 @@ class LatestCommentFeed(Feed):
def title(self):
if not hasattr(self, '_site'):
self._site = Site.objects.get_current()
- return u"%s comments" % self._site.name
+ return _("%(site_name)s comments") % dict(site_name=self._site.name)
def link(self):
if not hasattr(self, '_site'):
@@ -19,7 +20,7 @@ def link(self):
def description(self):
if not hasattr(self, '_site'):
self._site = Site.objects.get_current()
- return u"Latest comments on %s" % self._site.name
+ return _("Latest comments on %(site_name)s") % dict(site_name=self._site.name)
def items(self):
qs = comments.get_model().objects.filter(
View
16 django/contrib/comments/models.py
@@ -19,6 +19,7 @@ class BaseCommentAbstractModel(models.Model):
# Content-object field
content_type = models.ForeignKey(ContentType,
+ verbose_name=_('content type'),
related_name="content_type_set_for_%(class)s")
object_pk = models.TextField(_('object ID'))
content_object = generic.GenericForeignKey(ct_field="content_type", fk_field="object_pk")
@@ -46,7 +47,8 @@ class Comment(BaseCommentAbstractModel):
# Who posted this comment? If ``user`` is set then it was an authenticated
# user; otherwise at least user_name should have been set and the comment
# was posted by a non-authenticated user.
- user = models.ForeignKey(User, blank=True, null=True, related_name="%(class)s_comments")
+ user = models.ForeignKey(User, verbose_name=_('user'),
+ blank=True, null=True, related_name="%(class)s_comments")
user_name = models.CharField(_("user's name"), max_length=50, blank=True)
user_email = models.EmailField(_("user's email address"), blank=True)
user_url = models.URLField(_("user's URL"), blank=True)
@@ -71,6 +73,8 @@ class Meta:
db_table = "django_comments"
ordering = ('submit_date',)
permissions = [("can_moderate", "Can moderate comments")]
+ verbose_name = _('comment')
+ verbose_name_plural = _('comments')
def __unicode__(self):
return "%s: %s..." % (self.name, self.comment[:50])
@@ -161,10 +165,10 @@ class CommentFlag(models.Model):
design users are only allowed to flag a comment with a given flag once;
if you want rating look elsewhere.
"""
- user = models.ForeignKey(User, related_name="comment_flags")
- comment = models.ForeignKey(Comment, related_name="flags")
- flag = models.CharField(max_length=30, db_index=True)
- flag_date = models.DateTimeField(default=None)
+ user = models.ForeignKey(User, verbose_name=_('user'), related_name="comment_flags")
+ comment = models.ForeignKey(Comment, verbose_name=_('comment'), related_name="flags")
+ flag = models.CharField(_('flag'), max_length=30, db_index=True)
+ flag_date = models.DateTimeField(_('date'), default=None)
# Constants for flag types
SUGGEST_REMOVAL = "removal suggestion"
@@ -174,6 +178,8 @@ class CommentFlag(models.Model):
class Meta:
db_table = 'django_comment_flags'
unique_together = [('user', 'comment', 'flag')]
+ verbose_name = _('comment flag')
+ verbose_name_plural = _('comment flags')
def __unicode__(self):
return "%s flag of comment ID %s by %s" % \
Please sign in to comment.
Something went wrong with that request. Please try again.