♻️ Disable escaped characters in emails (#1369)

This commit is contained in:
Luke Vella 2024-10-01 10:40:18 +01:00 committed by GitHub
parent 5b96ad8778
commit d550f53b72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 6 additions and 20 deletions

View file

@ -1,3 +1,4 @@
import type { InitOptions } from "i18next";
import { createInstance } from "i18next";
import resourcesToBackend from "i18next-resources-to-backend";
import { initReactI18next } from "react-i18next/initReactI18next";
@ -13,12 +14,15 @@ i18nInstance
),
);
const i18nDefaultConfig = {
const i18nDefaultConfig: InitOptions = {
lng: "en",
fallbackLng: "en",
ns: ["emails"],
fallbackNS: "emails",
defaultNS: "emails",
interpolation: {
escapeValue: false,
},
} as const;
export type I18nInstance = typeof i18nInstance;

View file

@ -39,6 +39,7 @@ const FinalizeHostEmail = ({
ns: "emails",
defaultValue:
"Final date booked! We've notified participants and sent them calendar invites.",
title,
})}
>
<Heading>
@ -54,7 +55,6 @@ const FinalizeHostEmail = ({
i18nKey="finalizeHost_content"
ns="emails"
values={{ title }}
shouldUnescape={true}
components={{
b: <strong />,
}}
@ -126,9 +126,6 @@ FinalizeHostEmail.getSubject = (
defaultValue: "Date booked for {{title}}",
title: props.title,
ns: "emails",
interpolation: {
escapeValue: false,
},
});
};

View file

@ -53,7 +53,6 @@ const FinalizeParticipantEmail = ({
ns="emails"
defaults="<b>{{hostName}}</b> has booked <b>{{title}}</b> for the following date:"
values={{ hostName, title }}
shouldUnescape={true}
components={{
b: <strong />,
}}
@ -118,9 +117,6 @@ FinalizeParticipantEmail.getSubject = (
defaultValue: "Date booked for {{title}}",
title: props.title,
ns: "emails",
interpolation: {
escapeValue: false,
},
});
};

View file

@ -42,7 +42,6 @@ const NewCommentEmail = ({
ns="emails"
i18nKey="newComment_content"
defaults="<b>{{authorName}}</b> has commented on <b>{{title}}</b>."
shouldUnescape={true}
components={{
b: <strong />,
}}
@ -65,9 +64,6 @@ NewCommentEmail.getSubject = (
defaultValue: "{{authorName}} has commented on {{title}}",
authorName: props.authorName,
title: props.title,
interpolation: {
escapeValue: false,
},
});
};

View file

@ -69,9 +69,6 @@ NewParticipantEmail.getSubject = (
name: props.participantName,
title: props.title,
ns: "emails",
interpolation: {
escapeValue: false,
},
});
};

View file

@ -46,7 +46,6 @@ export const NewPollEmail = ({
i18nKey="newPoll_content"
ns="emails"
values={{ title }}
shouldUnescape={true}
components={{
b: <strong />,
}}
@ -72,9 +71,6 @@ NewPollEmail.getSubject = (props: NewPollEmailProps, ctx: EmailContext) => {
return ctx.t("newPoll_subject", {
defaultValue: "Let's find a date for {{title}}!",
title: props.title,
interpolation: {
escapeValue: false,
},
ns: "emails",
});
};