A casual little Directus extension that makes your system emails speak multiple languages! Because who doesn't want their password reset emails to be as international as their user base?
This extension hooks into Directus's email system and automatically localizes system emails based on
the user's language preference. It supports both custom .liquid
template files and translatable
subjects through the Directus translations system.
Pretty neat, right? 🎉
For detailed installation instructions, check out the official Directus documentation on extensions.
Quick example with pnpm (like the cool kids):
pnpm add --save-exact directus-extension-localized-system-emails
Then restart your Directus instance and you're good to go!
Note: We're hoping this extension will eventually be available in the Directus marketplace! 🤞
This is where the magic happens! You'll need to create localized versions of your email templates.
Step 1: Navigate to your Directus templates folder (usually ./templates
)
Step 2: Create your localized template files using this naming convention:
<template-name>-<language-code>.liquid
For example:
password-reset-en.liquid
(English)password-reset-nl.liquid
(Dutch)password-reset-fr.liquid
(French)user-invitation-de.liquid
(German)
Step 3: Copy your existing template content and translate it to the target language.
The extension will automatically pick up these files when sending emails to users with matching language preferences!
Want to translate email subjects too? Easy peasy!
Step 1: Go to your Directus Data Studio
Step 2: Navigate to the translations section
Step 3: Create translation entries with:
- Key:
<template-name>
(e.g.,password-reset
,user-invitation
) - Language: Your target language code
- Value: The translated subject line
Example translations:
- Key:
password-reset
, Language:en-US
, Value:Reset your password
- Key:
password-reset
, Language:nl-NL
, Value:Wachtwoord opnieuw instellen
- Key:
user-invitation
, Language:fr-FR
, Value:Invitation à rejoindre
Currently, this extension supports the following system email templates:
- password-reset - When users request a password reset
- user-invitation - When inviting new users to your Directus instance
- user-registration - When new users register (if registration is enabled)
These templates aren't supported at the moment, but hey, maybe in a future version:
- shared-item - Shared item notifications
- notifications - General system notifications
- When Directus tries to send a system email, this extension intercepts it
- It checks the recipient's language preference (or falls back to the system default)
- It looks for a localized template file (
<template>-<language>.liquid
) - It checks for a translated subject in the translations table
- If found, it uses the localized versions; otherwise, it falls back to the defaults
Simple as that! 🚀
Here's the thing - this extension might actually be temporary! The Directus team is actively working on native email translation support, which is pretty exciting. There are some great discussions happening around this:
- GitHub Discussion: Email Template Translations - The main discussion about implementing native email translation support
- Directus TV: Email Translations Request Review - A video discussing the future of email translations
So while this extension fills the gap for now, we're all looking forward to when Directus handles this natively. Until then, happy translating! 🌍
- Directus 10.10.0 or higher (up to 12.0.0)
- Node.js 16+ (because we're living in the future)
Found a bug? Want to add support for more templates? PRs are welcome! Just make sure to:
- Keep the code clean and well-commented
- Test your changes
- Update this README if needed
MIT License - because sharing is caring!
Big shoutout to jekuer/directus-extension-system-email-i18n for the inspiration! Their extension works great and helped shape the approach for this one. 🙏
Made with ❤️ by Jogchum Koerts
P.S. - If this extension saved you some time, consider giving it a star on GitHub! It makes me happy and costs you nothing. Win-win! ⭐