我在属性文件中有以下键/消息:
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.
在我的模板中,我尝试在 Thymeleaf 模板中显示如下:
<div id="alert-success" th:if="${#bools.isTrue(member)}" class="alert alert-success" th:utext="#{kadjoukor.registration.form.successMessage(${member.email})}"></div>
我得到的是:
Youve been successfully registered. An email has been sent to {0}. Please activate your registration by consulting your email.
注意参数没有被它的值替换,即我得到这个:{0}。另请注意,撇号已被 Spring 删除......
编辑: 这是我配置消息源的方式:
<bean class="org.springframework.context.support.ResourceBundleMessageSource" id="messageSource">
<property name="basenames" value="/META-INF/i18n/application,/META-INF/i18n/messages" />
</bean>