{"id":846,"date":"2023-08-10T13:14:58","date_gmt":"2023-08-10T12:14:58","guid":{"rendered":"https:\/\/www.help.headlight.tech\/?post_type=ht_kb&#038;p=846"},"modified":"2023-08-10T13:14:58","modified_gmt":"2023-08-10T12:14:58","slug":"how-can-i-create-multilingual-workflows","status":"publish","type":"ht_kb","link":"https:\/\/www.help.headlight.tech\/?ht_kb=how-can-i-create-multilingual-workflows","title":{"rendered":"How can I create multilingual workflows?"},"content":{"rendered":"\n<p>Do you have a diverse group of employees who speak various languages? Do not worry, Headlight has you covered.<\/p>\n\n\n\n<p>Headlight supports <a rel=\"noreferrer noopener\" href=\"https:\/\/jinja.palletsprojects.com\/en\/3.1.x\/\" data-type=\"URL\" data-id=\"https:\/\/jinja.palletsprojects.com\/en\/3.1.x\/\" target=\"_blank\">Jinja<\/a>-based templates in most of the configuration files. This means that aside from using <a href=\"https:\/\/www.help.headlight.tech\/?ht_kb=what-are-workflow-parameters\" data-type=\"URL\" data-id=\"https:\/\/www.help.headlight.tech\/?ht_kb=what-are-workflow-parameters\">parameter references <\/a>in your templates, you can also use if-else statements. <\/p>\n\n\n\n<p>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 <em>employee<\/em> has a <em>language_code<\/em> attribute in ISO 639-1 format, which is a 2-letter code in lower case letters, e.g. <em>nl<\/em>, <em>en<\/em>, or <em>de<\/em>. This code corresponds with the language setting that the employees has selected in their account. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How do I create language conditions in my template?<\/h2>\n\n\n\n<p>You can create language conditions in the same way as you can create other conditions in Headlight. Concretely, you use the following syntax:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<pre class=\"wp-block-code\"><code>{% if exampleTest %}\n     Text if exampleTest is true\n{% elif exampleTest2 %}\n     Text if exampleTest2 is true\n{% else %} Fallback result if none of the other conditions were true\n{% endif %}<\/code><\/pre>\n<\/blockquote>\n\n\n\n<p>The above structure applied to a multilingual message could look like this:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>{% if driver.language_code == &#8216;nl&#8217; %}Goedemiddag {{driver.first_name}}!<br>{% elif driver.language_code == &#8216;en&#8217;  %}Good afternoon  {{driver.first_name}}!<br>{% else %}Good afternoon  {{driver.first_name}}!<br>{% endif %}<\/p>\n<\/blockquote>\n\n\n\n<p>Of course, you can encapsulate your entire message and still use other parameters inside of the blocks. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"721\" src=\"https:\/\/www.help.headlight.tech\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-10-at-14.11.23-1024x721.png\" alt=\"\" class=\"wp-image-847\" srcset=\"https:\/\/www.help.headlight.tech\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-10-at-14.11.23-1024x721.png 1024w, https:\/\/www.help.headlight.tech\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-10-at-14.11.23-300x211.png 300w, https:\/\/www.help.headlight.tech\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-10-at-14.11.23-768x541.png 768w, https:\/\/www.help.headlight.tech\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-10-at-14.11.23-50x35.png 50w, https:\/\/www.help.headlight.tech\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-10-at-14.11.23-60x42.png 60w, https:\/\/www.help.headlight.tech\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-10-at-14.11.23-100x70.png 100w, https:\/\/www.help.headlight.tech\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-10-at-14.11.23.png 1398w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230;<\/p>\n","protected":false},"author":2,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":[],"ht-kb-category":[94],"ht-kb-tag":[73],"_links":{"self":[{"href":"https:\/\/www.help.headlight.tech\/index.php?rest_route=\/wp\/v2\/ht-kb\/846"}],"collection":[{"href":"https:\/\/www.help.headlight.tech\/index.php?rest_route=\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.help.headlight.tech\/index.php?rest_route=\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.help.headlight.tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.help.headlight.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=846"}],"version-history":[{"count":1,"href":"https:\/\/www.help.headlight.tech\/index.php?rest_route=\/wp\/v2\/ht-kb\/846\/revisions"}],"predecessor-version":[{"id":851,"href":"https:\/\/www.help.headlight.tech\/index.php?rest_route=\/wp\/v2\/ht-kb\/846\/revisions\/851"}],"wp:attachment":[{"href":"https:\/\/www.help.headlight.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=846"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.help.headlight.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fht-kb-category&post=846"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.help.headlight.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fht-kb-tag&post=846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}