Search code examples
htmlthymeleafproperties-file

I want to display a text as it is in the properties file with thymeleaf template engine


I have 2 files message_ar.properties and messages_fr.properties for the internationalization

In my html file I want to display the correct label for a confirm message

I'm using the thymeleaf as a template engine

    <a th:onclick="return confirm('#{label.deleteEmployee}')"

The browser displays the confirm message as it is in the html file!!

enter image description here

I want to display the confirm message as it is in the properties file!


Solution

  • I did it differently :

    <a th:if="#{direction}== 'rtl'" th:onclick="return confirm('هل نريد الحذف فعلا؟')" ...
    <a th:unless="#{direction}== 'rtl'" th:onclick="return confirm('Voulez vous vraiment supprimer cet employé?')"...