fix(email): use invoice language so email matches PDF attachment

This commit is contained in:
Gerhard Scheikl
2026-05-09 17:14:20 +02:00
parent b5d41046a0
commit d454843856
+4 -2
View File
@@ -67,8 +67,10 @@ export async function sendInvoiceEmail(
} }
if (!to) return failLog(args, "No recipient email available.", invoice.id); if (!to) return failLog(args, "No recipient email available.", invoice.id);
// Build email content. // Build email content. Always use the language the invoice PDF was
const language = pickLanguage(args.customerLocale ?? settings.defaultLanguage); // rendered in, so the email matches the attachment. Caller can still
// override via `customerLocale` if they really want a different language.
const language = pickLanguage(args.customerLocale ?? invoice.language ?? settings.defaultLanguage);
const t = getStrings(language); const t = getStrings(language);
const customer = parseCustomer(invoice.customerJson); const customer = parseCustomer(invoice.customerJson);
const totals = parseTotals(invoice.totalsJson); const totals = parseTotals(invoice.totalsJson);