Proper localization features for email templates and actions

Feature: Provide a short title of your feature request/feedback.

Proper localization features for email templates and actions.

Description: Give us some details about your feedback/feature request. Examples, screenshots, videos, etc. are helpful.

For email templates, you currently have to use very awkward if/else or case/when structures in order to provide localized alternatives. The subject line is even more difficult to work with.

Within actions, you have to include/repeat all translations, and use some form of map to look them up.

The DX and maintenance of this is terrible.

I would suggest adding a centralized translation database/dictionary, and allowing email templates and actions to reference keys in this dictionary. The keys could be full messages or translation IDs, and the values (messages) could be written using ICU MessageFormat syntax (f.e. Hello {username}, you are {age, number} years old).

The placeholder values could be based on available data, or you could specify the replacements when performing the translation.

There could also be ICU functions for localizing numbers and dates.

Instead of entering the subject and body with Liquid syntax (only), you could reference translation messages.

Subject: t("EMAIL_WELCOME_SUBJECT", {firstName: user.first_name}) [id-based]
Subject: t("Welcome {firstName}", {firstName: user.first_name}) [message-based]

Body:

<html>
    ...
    <body>
        t("EMAIL_WELCOME_BODY", {firstName: user.first_name})
    </body>
</html>

etc.

The syntax could be more Liquid-like (f.e. using filters), but you get the idea.

Actions would also have access to this translation dictionary, for localizing error messages, etc.

The translation database could include import/export and synchronization features.

The user’s locale should be set automatically by Auth0 based on the detected locale by default, which could be overridden within an action.

Use-case: Tell us what you are building. How would the feedback/feature improve your experience?

Websites and mobile apps that support multiple languages.

Hey there!

Thanks for creating this feedback card. Hope it gets some traction from the rest of community!

I totally agree that the DX experience with localization is bad. This also applies to universal login page templates where you need to duplicate the same html code for each language and do some case/when logic.

Alternatively I would also like to have the option to use the templating possibility of my email provider (SendGrid) instead of having to manage those templates in Auth0.

We ended up generating our templates from meta-template based on the approach described here : GitHub - pazel-io/auth0-i18n-liquid-template-generator

2 Likes

That seems to be the workaround everyone is implementing but I would expect better support for that in Auth0. If I buy a product like Auth0 I don’t expect to have to implement workarounds for such basic things.

4 Likes