♻️ 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 { createInstance } from "i18next";
import resourcesToBackend from "i18next-resources-to-backend"; import resourcesToBackend from "i18next-resources-to-backend";
import { initReactI18next } from "react-i18next/initReactI18next"; import { initReactI18next } from "react-i18next/initReactI18next";
@ -13,12 +14,15 @@ i18nInstance
), ),
); );
const i18nDefaultConfig = { const i18nDefaultConfig: InitOptions = {
lng: "en", lng: "en",
fallbackLng: "en", fallbackLng: "en",
ns: ["emails"], ns: ["emails"],
fallbackNS: "emails", fallbackNS: "emails",
defaultNS: "emails", defaultNS: "emails",
interpolation: {
escapeValue: false,
},
} as const; } as const;
export type I18nInstance = typeof i18nInstance; export type I18nInstance = typeof i18nInstance;

View file

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

View file

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

View file

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

View file

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

View file

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