ajay
ajay

Reputation: 9680

Formatting messages in Play application

I am using Play Framework (2.3.2) in Java for developing a web application. The message language is the default English (en), so I have a file named messages.en in the conf directory of the application.

How do I write long messages in the file? My message consists of several sentences. One option is to write them all in a single line but then I have to scroll horizontally to read it. Also, how can I format a message by putting html tags?

Upvotes: 0

Views: 198

Answers (1)

Daniel Olszewski
Daniel Olszewski

Reputation: 14401

You can separate multiple lines with the \ character

multiline.message=First line \
Second line
message.with.html=<b>Strong message</b>

The output for @Messages("multiline.message") will be:

First line Second line

HTML tags can be escaped with the helper object

@Html(Messages("message.with.html"))

Upvotes: 1

Related Questions