0

I am aware from this question that you can add parameters to messages like this:

<p th:text="#{messages.msg1(${param1})}"></p>

However, I need to be able to make this parameter a link. Is this possible?

For example:

# messages.properties
msg1=Hello, my name is {0}!

# messages_x.properties
msg1={0}, my name is!

Hello, my name is Kim

Kim, my name is

kboq
  • 21
  • 6

1 Answers1

1

It is possible by using th:utext and adding the link in the translation. Might not be ideal, but it should work:

msg1=Hello, my name is <a href="...">{0}</a>!

And:

<p th:utext="#{messages.msg1(${param1})}"></p>

(Note the utext instead of text, see documentation)

Wim Deblauwe
  • 25,113
  • 20
  • 133
  • 211