all repos — caroster @ 3d4c7a8d7bf3ac7f321e6298be1a7f7e65606c03

[Octree] Group carpool to your event https://caroster.io

🌐 Fix italian translation
Tim Izzo tim@5ika.ch
Mon, 02 Dec 2024 12:22:03 +0100
commit

3d4c7a8d7bf3ac7f321e6298be1a7f7e65606c03

parent

dea8fd9e913e3db6163b1d99864b9029744881ed

M backend/src/api/email/locales/it.jsonbackend/src/api/email/locales/it.json

@@ -1,4 +1,8 @@

{ + "template": { + "footer": "💝 Pensi anche tu che Caroster sia fantastico? Mantienilo libero e dacci supporto con una donazione!", + "carosterLink": "https://caroster.io/en/home" + }, "notifications": { "ConfirmEmail": { "content": "## Benvenuto/a a Caroster!\nPer favore conferma la registrazione del tuo account cliccando su questo link\n\n[<%= confirmationLink %>](<%= confirmationLink %>)",

@@ -52,9 +56,5 @@ "NewTrip": {

"title": "<%= event.name %> - È disponibile un nuovo passaggio", "content": "## È disponibile un nuovo passaggio per \"<%= event.name %>\"\n\n**Passaggio: <%= travel.vehicleName %>**\nNumero di posti: <%= travel.seats %>\nLuogo d'incontro: <%= travel.meeting %>\nInformazioni: <%= travel.details %>.\n\n[Prenota un posto per me!](<%= host %>/e/<%= event.uuid %>).\n\nStai ricevendo questa e-mail perché sei stato registrato/a alla lista d'attesa per ottenere un passaggio in auto per recarti a questo evento." } - }, - "template": { - "footer": "💝 Pensi anche tu che Caroster sia fantastico? Mantienilo libero e dacci supporto con una donazione!", - "carosterLink": "https://caroster.io/en/home" } }
M backend/src/api/email/services/email.tsbackend/src/api/email/services/email.ts

@@ -3,7 +3,7 @@ import _ from "lodash";

import { marked } from "marked"; import { getHTML } from "../utils/layout"; -const langs = ["en", "fr", "nl"]; +const langs = ["en", "fr", "nl", "it"]; let locales: Record< string,

@@ -60,16 +60,18 @@ }

}, async getEmailTemplate(notifType: string, lang: string, variables = {}) { - let notif = locales?.[lang]?.notifications?.[notifType]; + let matchingLocale = locales?.[lang]; - if (!notif) { + if (!matchingLocale) { strapi.log.warn( `No email notification locale found for type '${notifType}' and lang '${lang}'` ); - notif = locales?.["en"]?.notifications?.[notifType]; - if (!notif) return null; + matchingLocale = locales?.["en"]; + if (!matchingLocale) return null; } + const notif = matchingLocale.notifications?.[notifType]; + try { const subject = _.template(notif.title)({ ...variables,

@@ -79,11 +81,11 @@ const mdContent = _.template(notif.content)({

...variables, host: strapi.config.server.url, }); - const mdFooter = locales?.[lang]?.template.footer; - const carosterLink = locales?.[lang]?.template.carosterLink; + const mdFooter = matchingLocale.template.footer; + const carosterLink = matchingLocale.template.carosterLink; const htmlContent = await marked.parse(mdContent, { breaks: true }); const htmlFooter = await marked.parse(mdFooter, { breaks: true }); - const html = getHTML({htmlContent, htmlFooter, carosterLink}); + const html = getHTML({ htmlContent, htmlFooter, carosterLink }); return { subject,
M frontend/locales/it.jsonfrontend/locales/it.json

@@ -58,7 +58,7 @@ "travel.creation.phoneHelper.why": "Perché chiediamo un numero di telefono?",

"travel.creation.seats": "Numero di posti disponibili", "travel.creation.submit": "Aggiungi", "travel.creation.time": "Ora di partenza", - "travel.creation.title": "Aggiungi un viaggio", + "travel.creation.title": "Aggiungi un passaggio", "travel.creation.travel.dateHelper": "Seleziona una data valida", "travel.creation.travel.timeHelper": "Seleziona un orario valido", "travel.creation.travel.title": "Passaggio",