Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/+translatecontext.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix translation of comment byline. @erral
15 changes: 10 additions & 5 deletions src/plone/app/discussion/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from zope.component import queryUtility
from zope.component.factory import Factory
from zope.event import notify
from zope.globalrequest import getRequest
from zope.i18n import translate
from zope.i18nmessageid import Message
from zope.interface import implementer
Expand Down Expand Up @@ -206,6 +207,7 @@ def Title(self):
default="Anonymous",
),
),
context=getRequest(),
)
else:
author_name = self.author_name
Expand All @@ -220,8 +222,10 @@ def Title(self):
"author_name": safe_text(author_name),
"content": safe_text(content.Title()),
},
)
),
context=getRequest(),
)

return title

def Creator(self):
Expand Down Expand Up @@ -381,7 +385,7 @@ def notify_user(obj, event):
if not emails:
return

subject = translate(_("A comment has been posted."), context=obj.REQUEST)
subject = translate(_("A comment has been posted."), context=getRequest())
message = translate(
Message(
MAIL_NOTIFICATION_MESSAGE,
Expand All @@ -391,7 +395,7 @@ def notify_user(obj, event):
"text": obj.text,
},
),
context=obj.REQUEST,
context=getRequest(),
)
for email in emails:
# Send email
Expand Down Expand Up @@ -449,7 +453,7 @@ def notify_moderator(obj, event):
content_object = aq_parent(conversation)

# Compose email
subject = translate(_("A comment has been posted."), context=obj.REQUEST)
subject = translate(_("A comment has been posted."), context=getRequest())
message = translate(
Message(
MAIL_NOTIFICATION_MESSAGE_MODERATOR,
Expand All @@ -465,10 +469,11 @@ def notify_moderator(obj, event):
default="Anonymous",
),
),
context=getRequest(),
),
},
),
context=obj.REQUEST,
context=getRequest(),
)

# Send email
Expand Down
Loading