Templating Documentation

Internationalization

You have the ability to translate each text of your template of two manner

Conditional block

You can use the document locale variable and a conditional block.

{% if document.locale == 'en' %}

  <p>Please find below the details of your invoice.</p>
  <p>Please pay the amount of {{ document.total_with_vat }} by {{ document.due_date }}.</p>

{% elseif document.locale == 'fr' %}

  <p>Veuillez trouver ci-dessous le détail de votre facture.</p>
  <p>Veuillez payer le montant de {{ document.total_with_vat }} avant le {{ document.due_date }}.</p>

{% endif %}

Translate helper

You can use our build in helper

{% translate fr: "Facture", en: "Invoice" %}

or

{% t fr: "Facture", en: "Invoice" %}

Note

We recommand to use the conditionnal block if you have multiple lines to translate and the translate helper for one line translations.