0
votes

I am trying internacionalize the views of my current spring-boot / thymeleaf project. So far i did this:

  • in the html files, i change the references to the texts to this:

    h2 th:text="#{about.title}"

  • i add this line to my application.properties file:

    spring.messages.basename=i18n/messages

  • put the files *.properties (named with the same name of the html files for the default locale and and the suffix _pt_BR for portuguese locale in the folder /src/main/resources/templates/i18n/messages of my project.

but when i run the project and open it in the browser, instead of being displayed the correct message, i see things like> ??about.title??.

What i am doing wrong here?

1
Can you try to put your properties files here /src/main/resources/i18n/messages. - GUISSOUMA Issam
@GUISSOUMAIssam I solve this issue putting all the messages in a single message.properties in the directory /src/main/resources (and removing the line spring.messages.basename=i18n/messages from the application.properties. but now I am getting a problem with localized messages like that: logo.welcome=Welcome, <a th:href="@{/login}">log in</a> or <a th:href="@{/account}">register</a> (with the @{...} variable). - Kleber Mota

1 Answers

0
votes

You can put your properties files here /src/main/resources/i18n/messages and not in /src/main/resources/templates/i18n/messages