user2800089
user2800089

Reputation: 2401

how exactly does Messages work in play 2.0 framework

Kindly correct and elaborate if my understanding is wrong. Messages class is loaded at the startup of play application and Messages file ,as per default locale, is read and stored as key value pair which we can access using get() method.

Thanks

Upvotes: 0

Views: 130

Answers (1)

johanandren
johanandren

Reputation: 11479

Yes, this is correct. The Java Messages API essentially just calls the Scala API. So Messages.get("key") in the Java API calls Messages.apply("key") in the Scala API.

The actual data does not live in Messages though, instead it is implemented as a play plugin play.api.MessagesPlugin which is initialized on app start. The plugin will load the message file of each language that you have specified with the configuration key application.langs in 'conf/application.conf'.

Upvotes: 1

Related Questions