Apply html formatting to i18n messages

playframework-2.0

Solution

Do it like this:

@Html(Messages("task.created", MyContext.currentUser().firstName, newTask.code))

I hope this can help you!

Problem

In Play! 2.0 we can pass arguments to a i18n message like this: In my view: (message.key = task.created with arguments: firstName and a code) ``` <div class="alert alert-success"> <a class="close" data-dismiss="alert">×</a> @Messages("task.created", MyContext.currentUser().firstName, newTask.code) </div> ``` My message is defined as: ``` task.created=<strong>{0}</strong>, your task has been saved with code {1} ``` I would like to see the `firstName` with the HTML tag strong, but instead of applying the strong tag it just printing the `strong` tag. I hope you understand my question. Is this possible in Play or not? Thanks!

Original source