Prerequisites
To get the most out of this guide, you’ll need to:emails/welcome.vue
Internationalization with vue-i18n
vue-i18n is the internationalization plugin for Vue, which provides a way to format messages in different languages.1. Create messages for each locale
For each locale, create a new JSON file containing the content of the email in that locale.2. Create the i18n instance
Create a function that creates an i18n instance for a locale, with all the messages:emails/i18n.ts
3. Update the email template
In the email template, remove the hardcoded content and use thet function of useI18n() to format the email message strings.
emails/welcome.vue
4. Install vue-i18n when rendering
render renders each email with a new Vue application, so install vue-i18n on it, for the locale of
the email, with the setupApp option:
useI18n() too.
Previewing the emails
email dev renders emails with their PreviewProps, without setupApp, so it can’t install vue-i18n
for emails that call useI18n(). To preview an email, have it create its own i18n instance for a
locale prop instead, and use the t function of that instance:
emails/welcome.vue
locale prop whenever you render the email, with no need for setupApp: