(Advanced) Use Conditional Logic to Translate Templates
Use condition logic to customize your email templates by the recipient's preferred language.
With Cloze's Smart Templates you can insert your custom fields into emails and email templates.
Merge fields can be combined with conditions like these:
- if - If a specified field equals a specific value, display some content
- else if - Or else if a specified field has a specific value, display some other content
- else - If there is no match in either scenario, display some alternative content
Merge fields allow information to automatically populate ("merge") in an email making your emails more relevant to the recipient.
Merge fields may be called, variables, placeholders, or custom fields in other applications, but they are all generally the same. They are information that exists within a Cloze contact profile information that will automatically merge into the email when sent.
When using conditional text you can customize your emails even further.
Customize email by Language
For example, you can customize your email by language. In this example the template supports four languages:
Subject by language
- English: "en"
- Spanish: "es"
- French: "fr"
- Italian: "it"
If none of the above languages are set, it falls back to what is included in the "else" condition.
In the example below there is a subject line and body that is translated into each language.
Subject text to be inserted based on the conditions:
- English: Conditional Merge Field By Language
- Spanish: Campo de fusión condicional por idioma
- French: Champ de fusion conditionnel par langue
- Italian: Campo di unione condizionale per lingua
Subject with conditions:
{% if language == "en" %} Conditional Merge Field By Language {% else if language == "es" %} Campo de fusión condicional por idioma {% else if language == "fr" %} Champ de fusion conditionnel par langue {% else if language == "it" %} Campo di unione condizionale per lingua {% else %} Conditional Merge Field By Language {% end %}
Body text to be inserted based on the conditions:
English: Hello,
Enter the body of your email here in the local language of the recipient.
Spanish: Buenos Dias ,
Ingrese el cuerpo de su correo electrónico aquí en el idioma local del destinatario.
French: Bonjour,
Entrez le corps de votre email ici dans la langue du destinataire.- Italian: Buongiorno, Inserisci il corpo della tua email qui nella lingua locale del destinatario.
Setting the formatting and language for a person in Cloze
In this example, because the formatting is set to automatic and the country is set to Italy, any content that has been translated to Italian will be used. Cloze also translates based on language used in email communication
A preferred language can also be set by tapping on the Formatting dropdown and selecting a language.
In this example, because the formatting is set to English, any translated content will use English instead of Italian.