0

I have the following key/message in a properties file:

kadjoukor.registration.form.successMessage=You've been successfully registered. An email has been sent to <b>{0}</b>. Please activate your registration by consulting your email.

In my template, I try to display it as follows in a Thymeleaf template:

<div id="alert-success" th:if="${#bools.isTrue(member)}" class="alert alert-success" th:utext="#{kadjoukor.registration.form.successMessage(${member.email})}"></div>

All I get is:

Youve been successfully registered. An email has been sent to {0}. Please activate your registration by consulting your email.

Notice the argument has not been replaced by its value i.e. I get this: {0}. Also notice the apostrophe has been removed by Spring...

EDIT: Here is how I've configured the message source:

<bean class="org.springframework.context.support.ResourceBundleMessageSource" id="messageSource">
    <property name="basenames" value="/META-INF/i18n/application,/META-INF/i18n/messages" />
</bean>
balteo
  • 23,602
  • 63
  • 219
  • 412

1 Answers1

4

In order to prevent this problem, the apostrophe has to be escaped by another apostrophe.

See: Why Spring MessageSource arguments are not filled correctly in some locales?

However, note that this only occurs when there's one or several arguments in the message.

Community
  • 1
  • 1
balteo
  • 23,602
  • 63
  • 219
  • 412