Nowadays, customers love to be treated in the most personal way possible. Now your emails can speak as many languages as you want. With a little bit of Liquid syntax magic, you can easily tailor different emails for different markets (you can either translate them or create totally different content for customers who speak different languages). Starting is easy as 1-2-3:

1. Find the Language

Look up the language code (always use lowercase, as in our examples below). You have to use the 2 letter language code at the moment. For example, Spanish is es, English en and Portuguese would be pt

At this point you might be asking yourself how do we know the user's language? (I certainly did :). It comes from the user's custom field that was saved when they subscribed to the list. We automatically check browser language and save it for you so you can know which language each user speaks. You can also create these fields manually, using custom fields.

2. Mix up Some Liquid Magic

Below are the 2 snippets in liquid. One of the uses {% if ... else %} and the other {% case %} statement. They are both identical when it comes to the result, however as some people prefer to do it one way or the other we thought we'd include both. Just fire up your MoonMail code and add these:

{% if language == 'es' %}
    Por favor, confirme la suscripción
{% elsif language == 'pt' %}
    Por favor, confirme subscrição
{% else %}
    Please Confirm Subscription
{% endif %}

if .. elsif .. else syntax

{% case language %}
  {% when 'es' %}
     Por favor, confirme la suscripción
  {% when 'pt' %}
     Por favor, confirme subscrição
  {% else %}
     Please Confirm Subscription
{% endcase %}

case syntax - much easier when you have a lot of languages

3. Add Content and Send

That's all there is to it. Add the content you want to have for each language and send your emails. You can use this for confirmation emails or your campaigns. All thanks to a bit of liquid magic. 

Did this answer your question?