1. Home
  2. User Guide For Fleet Managers
  3. Workflows
  4. How can I create multilingual workflows?

How can I create multilingual workflows?

Do you have a diverse group of employees who speak various languages? Do not worry, Headlight has you covered.

Headlight supports Jinja-based templates in most of the configuration files. This means that aside from using parameter references in your templates, you can also use if-else statements.

This feature can be leveraged to enable multilingual workflows templates that speak to your employees in their language. Each parameter in your workflows that is of type employee has a language_code attribute in ISO 639-1 format, which is a 2-letter code in lower case letters, e.g. nl, en, or de. This code corresponds with the language setting that the employees has selected in their account.

How do I create language conditions in my template?

You can create language conditions in the same way as you can create other conditions in Headlight. Concretely, you use the following syntax:

{% if exampleTest %}
     Text if exampleTest is true
{% elif exampleTest2 %}
     Text if exampleTest2 is true
{% else %} Fallback result if none of the other conditions were true
{% endif %}

The above structure applied to a multilingual message could look like this:

{% if driver.language_code == ‘nl’ %}Goedemiddag {{driver.first_name}}!
{% elif driver.language_code == ‘en’ %}Good afternoon {{driver.first_name}}!
{% else %}Good afternoon {{driver.first_name}}!
{% endif %}

Of course, you can encapsulate your entire message and still use other parameters inside of the blocks.

Was this article helpful?

Related Articles

Leave a Comment