Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+35
@@ -0,0 +1,35 @@
|
||||
import type { MailFooterCopy, MailLanguage } from "@hivegrid/mail";
|
||||
import { defaultLocale, normalizeLocaleCandidate } from "@hivegrid/i18n";
|
||||
|
||||
import type { MailTranslator } from "~/locale/mail-translator.server";
|
||||
|
||||
export type LocalizedMailChrome = {
|
||||
readonly language: MailLanguage;
|
||||
readonly footerCopy: MailFooterCopy;
|
||||
};
|
||||
|
||||
function normalizeMailLanguage(locale?: string): MailLanguage {
|
||||
return normalizeLocaleCandidate(locale) ?? defaultLocale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the shared, user-visible mail footer from the same locale as the
|
||||
* message body. Direct React-email call sites must pass this chrome explicitly
|
||||
* so they cannot silently fall back to the package's English preview defaults.
|
||||
*/
|
||||
export function localizedMailChrome(t: MailTranslator, locale?: string): LocalizedMailChrome {
|
||||
return {
|
||||
language: normalizeMailLanguage(locale),
|
||||
footerCopy: {
|
||||
privacyLabel: t("common.legal.privacyLabel"),
|
||||
termsLabel: t("common.legal.termsLabel"),
|
||||
imprintLabel: t("common.legal.imprintLabel"),
|
||||
unsubscribeLabel: t("common.legal.unsubscribeLabel"),
|
||||
supportBefore: t("common.support.htmlBefore"),
|
||||
supportLinkLabel: t("common.support.emailLinkLabel"),
|
||||
supportAfter: t("common.support.htmlAfter"),
|
||||
signoffClosing: t("common.signoff.closing"),
|
||||
signoffTeam: t("common.signoff.team"),
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user