Translate e-mail subject

This commit is contained in:
Wolfgang Huß 2021-09-23 14:04:58 +02:00
parent d8b23d9df2
commit a87cc524a6
3 changed files with 8 additions and 12 deletions

View File

@ -106,9 +106,8 @@ export const wrongAccountTemplate = ({ email }) => {
} }
export const notificationTemplate = ({ email, notification }) => { export const notificationTemplate = ({ email, notification }) => {
// TODO Wolle language
const subject = `${CONFIG.APPLICATION_NAME} Benachrichtigung | Notification`
const actionUrl = new URL('/notifications', CONFIG.CLIENT_URI) const actionUrl = new URL('/notifications', CONFIG.CLIENT_URI)
const renderParams = { ...defaultParams, name: notification.to.name, actionUrl }
let content let content
switch (notification.to.locale) { switch (notification.to.locale) {
case 'de': case 'de':
@ -122,24 +121,19 @@ export const notificationTemplate = ({ email, notification }) => {
content = templatesEN.notification content = templatesEN.notification
break break
} }
const subjectUnrendered = content.split('\n')[0].split('"')[1]
const subject = mustache.render(subjectUnrendered, renderParams, {})
// Wolle console.log('subject: ', subject)
// Wolle // Wolle
// console.log( // console.log(
// mustache.render( // mustache.render(templates.layout, renderParams, { content }),
// templates.layout,
// { ...defaultParams, name: notification.to.name, actionUrl },
// { content },
// ),
// ) // )
return { return {
from, from,
to: email, to: email,
subject, subject,
html: mustache.render( html: mustache.render(templates.layout, renderParams, { content }),
templates.layout,
{ ...defaultParams, name: notification.to.name, actionUrl },
{ content },
),
} }
} }

View File

@ -1,3 +1,4 @@
<!-- emailSubject: "{{APPLICATION_NAME}} Benachrichtigung" -->
<!-- Email Body German : BEGIN --> <!-- Email Body German : BEGIN -->
<table class="email-german" align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" <table class="email-german" align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"
style="margin: auto;"> style="margin: auto;">

View File

@ -1,3 +1,4 @@
<!-- emailSubject: "{{APPLICATION_NAME}} Notification" -->
<!-- Email Body English : BEGIN --> <!-- Email Body English : BEGIN -->
<table class="email-german" align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" <table class="email-german" align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"
style="margin: auto;"> style="margin: auto;">