Translate emails.
Ship globally.
i18n-email translates transactional emails into any language with a single function call. Works with React Email and raw HTML.
npm install i18n-email<h1>Welcome!</h1>
<p>Your account has been created.</p>
<p>Here's what you can do next:</p><h1>Witamy!</h1>
<p>Twoje konto zostało utworzone.</p>
<p>Oto co możesz zrobić:</p>Three lines to translate
Create a client, call translate, send. The subject and HTML body come back ready to use.
import { createI18nEmail } from "i18n-email";
const i18n = createI18nEmail({
openaiApiKey: process.env.OPENAI_API_KEY!,
});
const { subject, html } = await i18n.translate({
locale: "pl",
subject: "Welcome!",
react: <WelcomeEmail name="Dan" />,
});Built for production
Everything you need to ship translated emails at scale, with nothing you don't.
React Email & HTML
Pass a React Email component or raw HTML. The library renders, extracts, and translates — you just pick a locale.
Single API call
Subject and body are translated together in one OpenAI request. No multiple round-trips, no orchestration.
Smart extraction
Only visible text is sent to OpenAI. Styles, scripts, head, and non-translatable markup are skipped automatically.
Built-in caching
Plug any async key-value store — Redis, Upstash, DynamoDB — and identical emails won't hit OpenAI twice.
RTL support
Arabic, Hebrew, Persian, and Urdu locales get dir="rtl" injected on the root element. Zero config.
Locale detection
The source language is detected automatically. If the email is already in the target locale, nothing changes.
How it works
Render
React components are rendered to HTML. Raw HTML is used as-is.
Extract
Visible text nodes and translatable attributes are collected and deduplicated.
Translate
All unique strings are sent to OpenAI in a single request and translated.
Inject
Translations are mapped back into the HTML. RTL direction is added if needed.
Maintainers
Start translating today
Add i18n-email to your project and reach every user in their language.
