Hoffmann Hoffmann - 3 months ago 50
Java Question

How to show localization messages with parameters in Spring 3 / Thymeleaf

I'm using Spring 3 and Thymeleaf to make some webpages and I am lost as for how to show messages like this:

welcome.message=Hello {0}, welcome!

and then replace {0} with the user name inside thymeleaf tags:

<h1 th:text="#{welcome.message}">Welcome Placeholder</h1>

I'm not even sure if {0} is the right syntax for the bundle message.


You can use


where some.attribute would be the value to use when replacing {0}.

You should be able to comma separate the values between the () to add more values to be used.