Navigation bar Translations

Hi everyone,

We made a navigation bar for our custom template with Dutch headers. We’d like to have a French and English translation on these words in the header but can’t find a way to make the right code to do this? Does anyone know how we could do this translation?

Thanks in advance,

{% comment %}-----TRANSLATION TAGS-----{% endcomment %}
{% t= "PD_algemene_info" nl:"Algemene info" en:"GENERAL_INFO" %}
{% t= "PD_boekhouding" nl:"Accountancy" en:"Accountancy" %}
{% t= "PD_btw" nl:"BTW" fr:"TVA" en:"VAT" %}
{% t= "PD_legal" nl:"Legal" en:"Legal" fr:"Legal %}
{% t= "PD_verzekeringen" nl:"Verzekeringen" fr:"Assurance" en:"Insurance" %}
{% t= "key" default:"translation" %}


{% t= "Algemene info" fr:"Info generale" %}

{% t= "Accountancy;ACCOUNTANCY|BTW;BTW_perm_file|Legal;LEGAL|TAKS;Taks" fr:"Accountancy;ACCOUNTANCY|TVA;TVA_perm_file|Legal;LEGAL|TAX;Tax" %}

{% comment %}Navigation Header{% endcomment %}

{% assign header_array = "Accountancy;ACCOUNTANCY|BTW;BTW_perm_file|Legal;LEGAL|TAKS;Taks" | split:"|" %}

{% ic %}
  {% stripnewlines %}
    <table class="usr-width-100 usr-bordered">
      <thead>
        <tr>
          <th class="usr-align-center usr-line-top usr-line-bottom usr-line-right usr-line-left usr-width-16">
            {% linkto period.reconciliations.general_info_perm_file %}Algemene info{% endlinkto %}
          </th>
          {% for template in header_array %}
            {% assign parts = template | split:";" %}
            {% assign template_name = parts[0] %}
            {% assign template_handle = parts[1] %}
            <th class="usr-align-center usr-line-top usr-line-bottom usr-line-right usr-line-left usr-width-17">
              {%if template_handle == current_reconciliation.handle %}
                <b>{{ template_name }}</b>
              {%else%}
                {% linkto period.reconciliations.[template_handle] %}
                  {{ template_name }}
                {% endlinkto %}
              {% endif %}
            </th>
          {% endfor %}
          <th class="usr-align-center usr-line-top usr-line-bottom usr-line-right usr-line-left usr-width-16">
            {% linkto period.reconciliations.VERZEKERINGEN %}Verzekeringen{% endlinkto %}
          </th>
        </tr>
      </thead>
      <tbody>
      </tbody>
    </table>
  {% endstripnewlines %}
{% endic %}
1 Like

Hi @Quinten_Deboot and welcome to the Community!

Nice job on the header so far.
The best way to make sure you can use the translation tags, would be to use the translation keys in your header_array, and instead of just printing them, use them in a translation.

So for example:

{% assign header_array = "PD_algemene_info;general_info_perm_file|PD_boekhouding;ACCOUNTANCY|PD_btw;BTW_perm_file|PD_legal;LEGAL|PD_verzekeringen;VERZEKERINGEN" | split:"|" %}

          {% for template in header_array %}
            {% assign parts = template | split:";" %}
            {% assign template_name = parts[0] %}
            {% assign template_handle = parts[1] %}
              {%if template_handle == current_reconciliation.handle %}
                <b>{% t template_name %}</b>
              {%else%}
                {% linkto period.reconciliations.[template_handle] %}
                  {% t template_name %}
                {% endlinkto %}
              {% endif %}
          {% endfor %}

All that’s left is adding French translation to the tags that you already created at the top of your code.

Hope that helps!

Kind regards
Romy

2 Likes

HI @Romy_Vermeeren The problem has been solved with your solution! Thanks for you response.

Kind regards,