Skip to content

Commit

Permalink
Add translation for default mail subject
Browse files Browse the repository at this point in the history
  • Loading branch information
laulaz committed Jun 13, 2022
1 parent b6aa0b2 commit b332d42
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/collective/easyform/interfaces/mailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
from z3c.form.browser.checkbox import CheckBoxFieldWidget
from z3c.form.browser.textarea import TextAreaWidget
from plone.autoform.interfaces import OMITTED_KEY

from zope.globalrequest import getRequest
from zope.i18n import translate
from zope.interface import provider
from zope.schema.interfaces import IContextAwareDefaultFactory

import zope.i18nmessageid
import zope.interface
Expand All @@ -24,6 +27,11 @@
MODIFY_PORTAL_CONTENT = "cmf.ModifyPortalContent"


@provider(IContextAwareDefaultFactory)
def default_mail_subject(context):
return translate(_(u"Form Submission"), context=getRequest())


def default_mail_body():
"""Default mail body for mailer action.
Acquire 'mail_body_default.pt' or return hard coded default
Expand Down Expand Up @@ -161,7 +169,7 @@ class IMailer(IAction):
u"do not specify a subject field or if the field "
u"is empty.",
),
default=u"Form Submission",
defaultFactory=default_mail_subject,
missing_value=u"",
required=False,
)
Expand Down

0 comments on commit b332d42

Please sign in to comment.