import i18next from "i18next";
import { render } from "@react-email/render";
import {
Head,
Html,
// ...
} from "@react-email/components";
type MyEmailTemplate {
i18nResources: Record;
locale: string;
// ...
}
export const MyEmailTemplate = ({
i18nResources,
locale,
// ..
}: MyEmailTemplate) => {
i18next.init({
// @ts-expect-error: Bro, I have to eat
resources: i18nResources,
lng: locale,
});
const t = i18next.t;
return (
{/* ... */}
{t("my_beautiful_key", { ns: "common" })}
{/* ... */}
);
};
export const renderMyEmailTemplate = ({
i18nResources,
locale,
// ..
}) =>
render(
,
{
pretty: true,
},
);