In the recipient's language
An email goes out from an action, a queue or a scheduled job, often caused by someone else: a cancellation reaches everyone booked, each in their own language. The language is saved with the booking, and void-fbtee's inLocale runs the email's code in it, its fbs strings and its dates included.
src/events/emails.ts
inLocale(booking.locale, ({ locale, dir }) => {Language and direction on the content
Gmail drops the email's html, head and body elements and keeps what's inside, so an Arabic email that says right to left only on html shows left to right. The content's own box says it too.
src/events/EmailLayout.tsx
<Container lang={locale} dir={dir} …>The email builder's own defaults
React Email, which this app builds its emails with, writes English, left to right around the content unless its Body is given the email's own language and direction.
src/events/EmailLayout.tsx
<Body lang={locale} dir={dir} …>Text in another language
An event's title is as its organiser wrote it, so it can be in another language than the email, as the Arabic title in the English and Thai emails here. It's marked with its own language and direction, with void-fbtee's langAttrs, as on the site's pages.
src/events/emails.ts
title: { text: event.title, ...langAttrs(event.titleLocale) },src/events/EmailLayout.tsx
<bdi lang={title.lang} dir={title.dir}>A written-out address
A web address is read left to right in every language. Written out in a right-to-left email, as the private link is, its parts come out reversed unless it's marked left to right.
src/events/EmailLayout.tsx
<a href={link} dir="ltr" …>Images inside the email
The logo is sent inside the email, with Void's inline attachments, rather than linked: it shows in every mail app, and in development too, where the site's address is localhost.
src/events/emails.ts
attachments: [logoAttachment],src/events/EmailLayout.tsx
<Img src="cid:logo" width="24" height="24" alt="" />