@@ -67,9 +67,7 @@ def create_notification_data(self, project) -> dict:
6767 )
6868
6969 email_context = {
70- "subject" : _ ("Here we go: {project_name} starts now!" ).format (
71- project_name = project .name
72- ),
70+ "subject" : _ ("Here we go: {project_name} starts now!" ),
7371 "headline" : _ ("Here we go!" ),
7472 "subheadline" : project .name ,
7573 "cta_url" : project .get_absolute_url (),
@@ -101,17 +99,15 @@ def get_recipients(self, project) -> List[User]:
10199
102100 def create_notification_data (self , project ) -> dict :
103101 email_context = {
104- "subject" : _ ("{project_name} has completed." ).format (
105- project_name = project .name
106- ),
102+ "subject" : _ ("{project_name} has completed." ),
107103 "subheadline" : project .name ,
108104 "cta_url" : project .get_absolute_url (),
109105 "cta_label" : _ ("View now" ),
110106 "reason" : _ (
111107 "This email was sent to {receiver_email}. You have received the e-mail because you are following the above project."
112108 ),
113109 "content_template" : "a4_candy_notifications/emails/content/project_ended.en.email" ,
114- "project " : project .name ,
110+ "project_name " : project .name ,
115111 }
116112
117113 return {
@@ -146,12 +142,8 @@ def create_notification_data(self, invitation) -> dict:
146142 project_type = "semi-public" if is_semipublic else "private"
147143
148144 email_context = {
149- "subject" : _ (
150- "Invitation to the {project_type} project: {project_name}"
151- ).format (project_type = project_type , project_name = project .name ),
152- "headline" : _ (
153- 'Invitation to the {project_type} project: "{project_name}"'
154- ).format (project_type = project_type , project_name = project .name ),
145+ "subject" : _ ("Invitation to the {project_type} project: {project_name}" ),
146+ "headline" : _ ('Invitation to the {project_type} project: "{project_name}"' ),
155147 "cta_url" : f"{ invitation .get_absolute_url ()} " ,
156148 "cta_label" : _ ("Accept invitation" ),
157149 "reason" : _ ("This email was sent to {receiver_email}." ),
@@ -194,19 +186,14 @@ def get_recipients(self, invitation) -> List[User]:
194186 def create_notification_data (self , invitation ) -> dict :
195187 project = invitation .project
196188 email_context = {
197- "subject" : _ ("Moderator invitation for project {project_name}" ).format (
198- project_name = project .name
199- ),
189+ "subject" : _ ("Moderator invitation for project {project_name}" ),
200190 "headline" : _ ("Moderator Invitation" ),
201191 "cta_url" : invitation .get_absolute_url (),
202192 "cta_label" : _ ("View Invitation" ),
203193 "reason" : _ ("This email was sent to {receiver_email}." ),
204194 "content_template" : "a4_candy_notifications/emails/content/project_moderation_invitation.en.email" ,
205195 "project_name" : project .name ,
206196 }
207- translated = _ (
208- "You have been invited to be a moderator of project {project_name}. View {invitation}"
209- )
210197 return {
211198 "notification_type" : NotificationType .PROJECT_MODERATION_INVITATION ,
212199 "message_template" : "You have been invited to be a moderator of project {project_name}. View {invitation}" ,
@@ -218,7 +205,6 @@ def create_notification_data(self, invitation) -> dict:
218205 "invitation" : "invitation" ,
219206 "invitation_url" : invitation .get_absolute_url (),
220207 "project_url" : None , # Explicitly no project link
221- "irrelevant" : translated , # translation hack, to remove
222208 },
223209 "email_context" : email_context ,
224210 }
@@ -233,8 +219,6 @@ def create_notification_data(self, project) -> dict:
233219 "subject" : _ ("New project {project_name} on {site_name}" ),
234220 "headline" : _ (
235221 "The new project {project_name} was created for {organisation_name}"
236- ).format (
237- project_name = project .name , organisation_name = project .organisation .name
238222 ),
239223 "cta_url" : project .get_absolute_url (),
240224 "cta_label" : _ ("Show project" ),
@@ -270,16 +254,15 @@ def get_recipients(self, project) -> List[User]:
270254 def create_notification_data (self , project ) -> dict :
271255 email_context = {
272256 "subject" : _ ("Deletion of project" ),
273- "headline" : _ ("The project {project} was deleted." ).format (
274- project = project .name
275- ),
257+ "headline" : _ ("The project {project_name} was deleted." ),
276258 "reason" : _ (
277259 "This email was sent to {receiver_email}. This email was sent to you because you are an initiator of the organisation '{organisation_name}', in which a project was deleted."
278260 ),
279261 # Content template
280262 "content_template" : "a4_candy_notifications/emails/content/project_deleted.en.email" ,
281263 # Template variables
282264 "project" : project .name ,
265+ "project_name" : project .name ,
283266 "organisation" : project .organisation .name ,
284267 "site" : project .organisation .site ,
285268 }
@@ -318,30 +301,22 @@ def create_notification_data(self, obj) -> dict:
318301 content_type_article = "An"
319302 email_context = {
320303 "subject" : _ (
321- "{article} {content_type} was added to the project {project}"
322- ).format (
323- article = content_type_article ,
324- content_type = content_type_display ,
325- project = obj .project .name ,
304+ "{article} {content_type_display} was added to the project {project_name}"
326305 ),
327306 "headline" : _ (
328- "{creator_name} created {article} {content_type} on the project {project}"
329- ).format (
330- article = content_type_article .lower (),
331- creator_name = obj .creator .username ,
332- content_type = content_type_display ,
333- project = obj .project .name ,
307+ "{creator_name} created {article_lower} {content_type_display} on the project {project_name}"
334308 ),
335309 "cta_url" : obj .get_absolute_url (),
336- "cta_label" : _ ("Check the {content_type}" ).format (
337- content_type = content_type_display
338- ),
310+ "cta_label" : _ ("Check the {content_type_display}" ),
339311 "reason" : _ (
340312 "This email was sent to {receiver_email}. This email was sent to you because you are a moderator in the project."
341313 ),
342314 # Content template
343315 "content_template" : "a4_candy_notifications/emails/content/user_content_created.en.email" ,
344316 # Template variables
317+ "article" : content_type_article ,
318+ "article_lower" : content_type_article .lower (),
319+ "project_name" : obj .project .name ,
345320 "project" : obj .project .name ,
346321 "creator_name" : obj .creator .username ,
347322 "content_type" : content_type .lower (),
0 commit comments