Customizing a Single Email Template for Multiple Languages

Overview

This article provides instructions for using conditional logic to support multiple languages within a single email template.

Applies To
  • Universal Login
  • Email Templates
  • Email Localization
Solution

The only method to support multiple languages in a single email template is to use if/else conditional statements with Liquid syntax.

  1. Define and store a user's language preference in a variable that is accessible by the email template. For example, use an Auth0 Action to set user.user_metadata.lang to the user's preferred language.

  2. Use conditional Liquid syntax in the email template to display different content blocks based on the language preference variable.

{% if user.user_metadata.lang == 'es' %}
Hola {{ user.name }}, ...
{% elsif user.user_metadata.lang == 'ru' %}
Ciao {{ user.name }}, ...
{% else %}
Hi {{ user.name }}, ...
{% endif %}


For an example of customizing the email subject of the Change Password Email Template based on the language specified in the user metadata, review the following video:

Recommended content

No recommended content found...