Jaime Ocampo
Jaime Ocampo

Reputation: 67

Unescaped messages in Play 2.0

I am playing a little bit with Play 2.0.

Now I have a problem regarding html elements in the message file.

I have the following template extract:

<footer>
  @Messages("footer")
</footer>

And in the file conf/messages I have:

footer= Test &reg;

When the page is displayed, the message is escaped and displayed as

Test &amp; reg;

I do not want the message to be escaped! I want my html element (®) displayed as it is! But it is not working.

How can I provide the string, so that no escaping takes place? I have tried the following to no avail:

footer= Test \&reg;
footer= Test '&reg;'
footer= test '&'reg;

Upvotes: 0

Views: 713

Answers (1)

adis
adis

Reputation: 5951

If you have HTML element in your translation strings you should include them as follows in the template:

@Html(Messages("footer"))

Or did I completely misunderstood your question?

Upvotes: 8

Related Questions