CASE: how to translate templates for use in other language (fr, en)?

If you create a template from scratch, it might be a good idea to consider the template being available in all 3 languages.
You can do this in the same template (so you don’t need to copy a template and translate the copy for instance).

First, let’s take a look at a template that isn’t translated. Let’s look at a table header for instance :

 |     Bedrag     |    Rekening     |  

These words needs to be translated to EN and FR for instance.

The way of doing that, is giving ‘translation’ tags to these words in the table header:

|     {% t "Bedrag" %}     |    {% t "Rekening" %}     |

Now, you can add the translations. Typically you add these on top of all your coding of the template :

{% t= "Bedrag" fr:"Montant" en:"Amount" %}
{% t= "Rekening" fr:"Compte" en:"Account" %}

An example of a template that is completely translated :

{% t= "titel" fr:"titre" en:"title" %}
{% t= "waarde" fr:"valeur" en:"value" %}
{% t= "titel" fr:"titre" en:"title" %}


{% fori detail in current_account.details %}{% if forloop.first %}
|--------------25%-----------------|--------------------45%-----------|------10%------|-------20%--------:+{% endif %}
|{% input detail.custom.title placeholder:'titel' %}| {% ic %}{% input detail.custom.text as:text size:mini placeholder:'extra info' %}{% endic %}{% nic %}{{ detail.custom.text | multiline_table}}{% endnic %}|{% input detail.custom.doc as:file %}|{% if forloop.last %}{% endif %}{% if current_account.liability_or_income %}{% $0+input detail.custom.value as:n_currency placeholder:'waarde' %}{% else %}{% $0+input detail.custom.value as:currency placeholder:'waarde' %}{% endif %}{% ic %}{% if forloop.last %}
|               |   |    |**{% if current_account.liability_or_income %}{{ -1*$0 | currency }}{% else %}{{ $0 | currency }}{% endif %}**{% endif %}{% endic %}{% endfori %} 

It should be noted though, you can only do this for account and reconciliation templates.

1 Like