Skip to main content
The simplest way to localize an email needs no library at all: load the messages for the recipient’s locale where you send the email, and pass them to it as a prop. The email only renders the strings it’s given, so it works the same with render, in email dev, and with any i18n library your app already uses to pick the messages. This guide shows how to convert an English Vuemail template to support multiple locales.

Prerequisites

To get the most out of this guide, you’ll need to: This guide will use the same email template as a base as the vue-i18n guide.

Passing messages as props

1. Create messages for each locale

For each locale, create a new JSON file containing the content of the email in that locale.

2. Update the email props

Add a messages prop to the email template, with a type for its messages, and use the English messages for the preview. defineOptions can reference imports, so the preview uses the same file:
emails/welcome.vue

3. Update the email template

In the email template, remove the hardcoded content and render the messages instead.
emails/welcome.vue

4. Update any email calls

When calling the email template, load the messages for the recipient’s locale and pass them to the email.