Skip to content

Commit

Permalink
Merge pull request #33 from xeptagondev/email-translations
Browse files Browse the repository at this point in the history
add email template for language
  • Loading branch information
janithr1 authored Nov 29, 2024
2 parents c3d9f70 + 1977456 commit 86f8840
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 26 deletions.
4 changes: 2 additions & 2 deletions libs/common/src/lib/tasks-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const TasksLabels = {
audio_url:'audio_url',
message:'message',
original_reported_date: 'original_reported_date',
meedan_category:'category'
meedan_category:'Category'
},
es: {
claim: 'Declaración',
Expand Down Expand Up @@ -87,7 +87,7 @@ export const TasksLabels = {
audio_url:'audio_url',
message:'message',
original_reported_date: 'original_reported_date',
meedan_category:'categoria'
meedan_category:'Categoria'
},
fr: {
claim: 'Affirmation',
Expand Down
41 changes: 17 additions & 24 deletions libs/email/src/lib/email.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { MailerService } from '@nestjs-modules/mailer';
import { Injectable } from '@nestjs/common';
import { Article } from '@iverify/iverify-common';
import { EmailTranslations } from './templates/email-translations';
let converter = require('json-2-csv');

@Injectable()
export class EmailService {
lang = process.env.language;
constructor(private mailerService: MailerService) {}

async sendCsvReport(data: Article[], date: string) {
Expand Down Expand Up @@ -67,6 +69,7 @@ export class EmailService {
factCheckedLink: string,
date?: string
): Promise<void> {
const t = EmailTranslations[this.lang];
try {
let htmlContent = `<div class="">
<div class="aHl"></div>
Expand Down Expand Up @@ -150,14 +153,14 @@ export class EmailService {
line-height: 1.5;
"
>
<p style="text-align: left">Bonjour,</p>
<p style="text-align: left">${t.greeting}</p>
<p style="text-align: left">&nbsp;</p>
<p style="text-align: left">
Vous avez récemment souscrit à notre service de notifications pour être informé lorsque du contenu est vérifié par l’equipe iVerify.
${t.introSubmit}
</p>
<p style="text-align: left">&nbsp;</p>
<p style="text-align: left">
Nous vous informons que le contenu que vous aviez signalé ou suivi a été fact-checké. Vous pouvez consulter les résultats de notre analyse en suivant le lien ci-dessous :
${t.factCheckedNotification}
</p>
</td>
</tr>
Expand Down Expand Up @@ -304,7 +307,7 @@ export class EmailService {
"
target="_blank"
data-saferedirecturl="https://www.google.com/url?q=${factCheckedLink}"
>En savoir plus...</a
>${t.learnMore}</a
>
</td>
</tr>
Expand Down Expand Up @@ -382,12 +385,11 @@ export class EmailService {
"
>
<p>
Nous vous remercions pour votre engagement envers la vérification des informations et vous encourageons à partager ces résultats avec vos contacts sur les réseaux sociaux afin de contribuer à la diffusion d'informations fiables.
${t.thanksSubmit}
</p>
<p style="text-align: left">&nbsp;</p>
<p>
Cordialement,<br />L’équipe de
vérification des faits iVerify
${t.regards}<br /> ${t.team}
</p>
</td>
</tr>
Expand Down Expand Up @@ -591,6 +593,7 @@ export class EmailService {
}

async sendEmailForSubscribers(email: string, lists: any): Promise<void> {
const t = EmailTranslations[this.lang];
try {
let htmlContent = `<div class="">
<div class="aHl"></div>
Expand Down Expand Up @@ -674,18 +677,14 @@ export class EmailService {
line-height: 1.5;
"
>
<p style="text-align: left">Bonjour,</p>
<p style="text-align: left">${t.greeting}</p>
<p style="text-align: left">&nbsp;</p>
<p style="text-align: left">
Merci de vous être abonné à notre
service de notifications pour suivre
les dernières vérifications effectuées
par l’équipe iVerify.
${t.intro}
</p>
<p style="text-align: left">&nbsp;</p>
<p style="text-align: left">
Voici les contenus qui ont été
fact-checkés aujourd'hui :
${t.todayFactCheck}
</p>
</td>
</tr>
Expand Down Expand Up @@ -749,7 +748,7 @@ export class EmailService {
<tr>
<td align="center" bgcolor="#0385ca" role="presentation" style="border-collapse: separate !important; background: #0385ca; border-radius: 5px;" valign="middle">
<a href="${list.link}" style="display: inline-block; color: #ffffff; font-family: Helvetica, Arial, sans-serif; font-size: 12px; font-weight: normal; line-height: 120%; margin: 0; text-decoration: none; text-transform: none; padding: 10px 25px; border-radius: 5px; width: auto;" target="_blank">
En savoir plus...
${t.learnMore}
</a>
</td>
</tr>
Expand Down Expand Up @@ -905,7 +904,7 @@ export class EmailService {
"
target="_blank"
data-saferedirecturl="https://www.google.com/url?q=${list.link}"
>En savoir plus...</a
>${t.learnMore}</a
>
</td>
</tr>
Expand Down Expand Up @@ -985,17 +984,11 @@ export class EmailService {
"
>
<p>
Nous vous remercions pour votre
engagement dans la lutte contre la
désinformation et vous invitons à
partager ces résultats sur vos réseaux
sociaux pour contribuer à la diffusion
d'informations fiables.
${t.thanks}
</p>
<p style="text-align: left">&nbsp;</p>
<p>
Cordialement,<br />L’équipe de
vérification des faits iVerify
${t.regards}<br />${t.team}
</p>
</td>
</tr>
Expand Down
28 changes: 28 additions & 0 deletions libs/email/src/lib/templates/email-translations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export const EmailTranslations = {
en: {
greeting: 'Hello,',
intro: 'Thank you for subscribing to our notifications service to follow the latest checks carried out by the iVerify team.',
todayFactCheck: "Here are the contents that were fact-checked today:",
thanks: "We thank you for your commitment to combating misinformation and invite you to share these results on your social networks to contribute to the dissemination of reliable information.",
regards: "Best regards,",
team: "The iVerify fact-checking team",
learnMore: "Learn more...",
introSubmit: 'You recently subscribed to our notification service to be informed whenever content is fact-checked by the iVerify team.',
factCheckedNotification:
"We inform you that the content you reported or followed has been fact-checked. You can view the results of our analysis by following the link below:",
thanksSubmit: "We thank you for your commitment to verifying information and encourage you to share these results with your social media contacts to help disseminate reliable information."
},
fr: {
greeting: 'Bonjour,',
intro: "Merci de vous être abonné à notre service de notifications pour suivre les dernières vérifications effectuées par l’équipe iVerify.",
todayFactCheck: "Voici les contenus qui ont été fact-checkés aujourd'hui :",
thanks: "Nous vous remercions pour votre engagement dans la lutte contre la désinformation et vous invitons à partager ces résultats sur vos réseaux sociaux pour contribuer à la diffusion d'informations fiables.",
regards: "Cordialement,",
team: "L’équipe de vérification des faits iVerify",
learnMore: "En savoir plus...",
introSubmit: "Vous avez récemment souscrit à notre service de notifications pour être informé lorsque du contenu est vérifié par l'équipe iVerify.",
factCheckedNotification:
"Nous vous informons que le contenu que vous aviez signalé ou suivi a été fact-checké. Vous pouvez consulter les résultats de notre analyse en suivant le lien ci-dessous :",
thanksSubmit: "Nous vous remercions pour votre engagement envers la vérification des informations et vous encourageons à partager ces résultats avec vos contacts sur les réseaux sociaux afin de contribuer à la diffusion d'informations fiables."
},
}

0 comments on commit 86f8840

Please sign in to comment.